Decompiled source of Good bye Style Go Round v0.0.2

StyleGoRound.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("StyleGoRound")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Idea directly copied from DmC")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+62b9121d8ee99e4caeb4e971f5d69e0bd2b8f873")]
[assembly: AssemblyProduct("StyleGoRound")]
[assembly: AssemblyTitle("StyleGoRound")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace StyleGoRound
{
	[HarmonyPatch(typeof(Drone), "GetHurt")]
	public static class DroneGetHurtPatch
	{
		public static bool Prefix(ref Vector3 force, ref float multiplier, ref GameObject sourceWeapon, ref bool fromExplosion, Drone __instance)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (force == Vector3.zero && multiplier >= 999f && (Object)(object)sourceWeapon == (Object)null && !fromExplosion)
				{
					return true;
				}
				if (RankChecker.IsRanked())
				{
					return true;
				}
				AdjustedMethod(ref force, ref multiplier, ref sourceWeapon, ref fromExplosion, __instance);
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error in DroneGetHurtPatch: " + ex.Message));
				return true;
			}
		}

		public static void AdjustedMethod(ref Vector3 force, ref float multiplier, ref GameObject sourceWeapon, ref bool fromExplosion, Drone __instance)
		{
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a79: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af0: Invalid comparison between Unknown and I4
			//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0663: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_066e: Unknown result type (might be due to invalid IL or missing references)
			//IL_087d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0881: Invalid comparison between Unknown and I4
			//IL_082c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0836: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Invalid comparison between Unknown and I4
			//IL_09aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_09af: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0906: Unknown result type (might be due to invalid IL or missing references)
			//IL_091d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0922: Unknown result type (might be due to invalid IL or missing references)
			//IL_093d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0947: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo fieldInfo = AccessTools.Field(typeof(Drone), "eid");
			object? value = fieldInfo.GetValue(__instance);
			EnemyIdentifier val = (EnemyIdentifier)((value is EnemyIdentifier) ? value : null);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(Drone), "parryable");
			bool valueOrDefault = (fieldInfo2.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo3 = AccessTools.Field(typeof(Drone), "parryFramesLeft");
			int valueOrDefault2 = (fieldInfo3.GetValue(__instance) as int?).GetValueOrDefault();
			FieldInfo fieldInfo4 = AccessTools.Field(typeof(Drone), "homeRunnable");
			bool valueOrDefault3 = (fieldInfo4.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo5 = AccessTools.Field(typeof(Drone), "scalc");
			object? value2 = fieldInfo5.GetValue(__instance);
			StyleCalculator val2 = (StyleCalculator)((value2 is StyleCalculator) ? value2 : null);
			PropertyInfo propertyInfo = AccessTools.Property(typeof(Drone), "target");
			object? value3 = propertyInfo.GetValue(__instance);
			EnemyTarget val3 = (EnemyTarget)((value3 is EnemyTarget) ? value3 : null);
			FieldInfo fieldInfo6 = AccessTools.Field(typeof(Drone), "crashTarget");
			Vector3 val4 = (Vector3)(((??)(fieldInfo6.GetValue(__instance) as Vector3?)) ?? Vector3.zero);
			FieldInfo fieldInfo7 = AccessTools.Field(typeof(Drone), "canHurtOtherDrones");
			bool valueOrDefault4 = (fieldInfo7.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo8 = AccessTools.Field(typeof(Drone), "rb");
			object? value4 = fieldInfo8.GetValue(__instance);
			Rigidbody val5 = (Rigidbody)((value4 is Rigidbody) ? value4 : null);
			FieldInfo fieldInfo9 = AccessTools.Field(typeof(Drone), "aud");
			object? value5 = fieldInfo9.GetValue(__instance);
			AudioSource val6 = (AudioSource)((value5 is AudioSource) ? value5 : null);
			FieldInfo fieldInfo10 = AccessTools.Field(typeof(Drone), "type");
			EnemyType valueOrDefault5 = (fieldInfo10.GetValue(__instance) as EnemyType?).GetValueOrDefault((EnemyType)1);
			FieldInfo fieldInfo11 = AccessTools.Field(typeof(Drone), "bsm");
			object? value6 = fieldInfo11.GetValue(__instance);
			BloodsplatterManager val7 = (BloodsplatterManager)((value6 is BloodsplatterManager) ? value6 : null);
			FieldInfo fieldInfo12 = AccessTools.Field(typeof(Drone), "gz");
			object? value7 = fieldInfo12.GetValue(__instance);
			GoreZone val8 = (GoreZone)((value7 is GoreZone) ? value7 : null);
			FieldInfo fieldInfo13 = AccessTools.Field(typeof(Drone), "parried");
			bool valueOrDefault6 = (fieldInfo13.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo14 = AccessTools.Field(typeof(Drone), "canInterruptCrash");
			bool valueOrDefault7 = (fieldInfo14.GetValue(__instance) as bool?).GetValueOrDefault();
			bool flag = false;
			if (!__instance.crashing)
			{
				if ((val.hitter == "shotgunzone" || val.hitter == "hammerzone") && !valueOrDefault && __instance.health - multiplier > 0f)
				{
					return;
				}
				if (((val.hitter == "shotgunzone" || val.hitter == "hammerzone") && valueOrDefault) || val.hitter == "punch")
				{
					if (valueOrDefault)
					{
						if (!InvincibleEnemies.Enabled && !val.blessed)
						{
							multiplier = ((valueOrDefault2 > 0) ? 3 : 4);
						}
						MonoSingleton<FistControl>.Instance.currentPunch.Parry(false, val, "");
						fieldInfo2.SetValue(__instance, false);
					}
					else
					{
						fieldInfo3.SetValue(__instance, MonoSingleton<FistControl>.Instance.currentPunch.activeFrames);
					}
				}
				if (val.blessed || !InvincibleEnemies.Enabled)
				{
				}
				__instance.health = (float)Math.Round(__instance.health, 4);
				if ((double)__instance.health <= 0.001)
				{
					__instance.health = 0f;
				}
				if ((Object)(object)val == (Object)null)
				{
					val = ((Component)__instance).GetComponent<EnemyIdentifier>();
				}
				if (__instance.health <= 0f)
				{
					flag = true;
				}
				if (valueOrDefault3 && !__instance.fleshDrone && !val.puppet && flag && (val.hitter == "punch" || val.hitter == "heavypunch" || val.hitter == "hammer"))
				{
					MonoSingleton<StyleHUD>.Instance.AddPoints(100, "ultrakill.homerun", sourceWeapon, val, -1, "", "");
					MonoSingleton<StyleCalculator>.Instance.AddToMultiKill((GameObject)null);
				}
				else if (val.hitter != "enemy" && !val.puppet && multiplier != 0f)
				{
					if ((Object)(object)val2 == (Object)null)
					{
						val2 = MonoSingleton<StyleCalculator>.Instance;
					}
					if (Object.op_Implicit((Object)(object)val2))
					{
						val2.HitCalculator(val.hitter, "drone", "", flag, val, sourceWeapon);
					}
				}
				if (__instance.health <= 0f && !__instance.crashing)
				{
					fieldInfo2.SetValue(__instance, false);
					AccessTools.Method(typeof(Drone), "Death", (Type[])null, (Type[])null).Invoke(__instance, new object[1] { fromExplosion });
					if (val.hitter != "punch" && val.hitter != "heavypunch" && val.hitter != "hammer")
					{
						if (val3 != null)
						{
							fieldInfo6.SetValue(__instance, val3.position);
						}
					}
					else
					{
						fieldInfo7.SetValue(__instance, true);
						Transform transform = ((Component)__instance).transform;
						transform.position += ((Vector3)(ref force)).normalized;
						fieldInfo6.SetValue(__instance, ((Component)__instance).transform.position + force);
						if (!val5.isKinematic)
						{
							val5.velocity = ((Vector3)(ref force)).normalized * 40f;
						}
					}
					((Component)__instance).transform.LookAt(val4);
					if ((Object)(object)val6 == (Object)null)
					{
						val6 = ((Component)__instance).GetComponent<AudioSource>();
					}
					if ((int)valueOrDefault5 == 1)
					{
						val6.clip = __instance.deathSound;
						val6.volume = 0.75f;
						val6.pitch = Random.Range(0.85f, 1.35f);
						val6.priority = 11;
						val6.Play();
					}
					else
					{
						__instance.PlaySound(__instance.deathSound);
					}
					((MonoBehaviour)__instance).Invoke("CanInterruptCrash", 0.5f);
					((MonoBehaviour)__instance).Invoke("Explode", 5f);
					return;
				}
				if (!(val.hitter != "fire"))
				{
					__instance.PlaySound(__instance.hurtSound);
					return;
				}
				GameObject val9 = null;
				Bloodsplatter val10 = null;
				if (multiplier != 0f)
				{
					if (!val.blessed)
					{
						__instance.PlaySound(__instance.hurtSound);
					}
					val9 = val7.GetGore((GoreType)2, val, fromExplosion);
					val9.transform.position = ((Component)__instance).transform.position;
					val9.SetActive(true);
					val9.transform.SetParent(val8.goreZone, true);
					if (val.hitter == "drill")
					{
						Transform transform2 = val9.transform;
						transform2.localScale *= 2f;
					}
					val10 = val9.GetComponent<Bloodsplatter>();
				}
				if (__instance.health > 0f)
				{
					if (val.hitter == "nail")
					{
						val10.hpAmount = (((int)valueOrDefault5 != 9) ? 1 : 3);
						AudioSource component = ((Component)val10).GetComponent<AudioSource>();
						component.volume *= 0.8f;
					}
					if (Object.op_Implicit((Object)(object)val10))
					{
						val10.GetReady();
					}
					if (!val.blessed && !val5.isKinematic)
					{
						val5.velocity /= 10f;
						val5.AddForce(((Vector3)(ref force)).normalized * (((Vector3)(ref force)).magnitude / 100f), (ForceMode)1);
						val5.collisionDetectionMode = (CollisionDetectionMode)2;
						Vector3 velocity = val5.velocity;
						if (((Vector3)(ref velocity)).magnitude > 50f)
						{
							val5.velocity = Vector3.ClampMagnitude(val5.velocity, 50f);
						}
					}
				}
				if (multiplier >= 1f)
				{
					if (Object.op_Implicit((Object)(object)val10))
					{
						val10.hpAmount = 30;
					}
					if (__instance.gib != null)
					{
						for (int i = 0; (float)i <= multiplier; i++)
						{
							Object.Instantiate<GameObject>(AddressablesExtensions.ToAsset(__instance.gib), ((Component)__instance).transform.position, Random.rotation).transform.SetParent(val8.gibZone, true);
						}
					}
				}
				ParticleSystem val11 = default(ParticleSystem);
				if (MonoSingleton<BloodsplatterManager>.Instance.goreOn && Object.op_Implicit((Object)(object)val9) && val9.TryGetComponent<ParticleSystem>(ref val11))
				{
					val11.Play();
				}
			}
			else if ((val.hitter == "punch" || val.hitter == "hammer") && !valueOrDefault6)
			{
				fieldInfo13.SetValue(__instance, true);
				if (!val5.isKinematic)
				{
					val5.velocity = Vector3.zero;
				}
				((Component)__instance).transform.rotation = ((Component)MonoSingleton<CameraController>.Instance).transform.rotation;
				Punch currentPunch = MonoSingleton<FistControl>.Instance.currentPunch;
				if (val.hitter == "punch")
				{
					((Component)currentPunch).GetComponent<Animator>().Play("Hook", -1, 0.065f);
					currentPunch.Parry(false, val, "");
				}
				Collider val12 = default(Collider);
				if ((int)valueOrDefault5 == 9 && ((Component)__instance).TryGetComponent<Collider>(ref val12))
				{
					val12.isTrigger = true;
				}
			}
			else if (multiplier >= 1f || valueOrDefault7)
			{
				__instance.Explode();
			}
		}
	}
	[HarmonyPatch(typeof(Machine), "GetHurt")]
	public static class MachineGetHurtPatch
	{
		public static bool Prefix(ref GameObject target, ref Vector3 force, ref float multiplier, ref float critMultiplier, ref GameObject sourceWeapon, ref bool fromExplosion, Machine __instance)
		{
			try
			{
				if (multiplier >= 999f)
				{
					return true;
				}
				if (RankChecker.IsRanked())
				{
					return true;
				}
				AdjustedMethod(ref target, ref force, ref multiplier, ref critMultiplier, ref sourceWeapon, ref fromExplosion, __instance);
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error in MachineGetHurtPatch: " + ex.Message + "\n" + ex.StackTrace));
				return true;
			}
		}

		public static void AdjustedMethod(ref GameObject target, ref Vector3 force, ref float multiplier, ref float critMultiplier, ref GameObject sourceWeapon, ref bool fromExplosion, Machine __instance)
		{
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1540: Unknown result type (might be due to invalid IL or missing references)
			//IL_151e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1523: Unknown result type (might be due to invalid IL or missing references)
			//IL_156b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1575: Unknown result type (might be due to invalid IL or missing references)
			//IL_0deb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dfc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1262: Unknown result type (might be due to invalid IL or missing references)
			//IL_14af: Unknown result type (might be due to invalid IL or missing references)
			//IL_15d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_15de: Unknown result type (might be due to invalid IL or missing references)
			//IL_1450: Unknown result type (might be due to invalid IL or missing references)
			//IL_1477: Unknown result type (might be due to invalid IL or missing references)
			//IL_106f: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo fieldInfo = AccessTools.Field(typeof(Machine), "eid");
			object? value = fieldInfo.GetValue(__instance);
			EnemyIdentifier val = (EnemyIdentifier)((value is EnemyIdentifier) ? value : null);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(Machine), "sm");
			object? value2 = fieldInfo2.GetValue(__instance);
			SwordsMachine val2 = (SwordsMachine)((value2 is SwordsMachine) ? value2 : null);
			FieldInfo fieldInfo3 = AccessTools.Field(typeof(Machine), "v2");
			object? value3 = fieldInfo3.GetValue(__instance);
			V2 val3 = (V2)((value3 is V2) ? value3 : null);
			FieldInfo fieldInfo4 = AccessTools.Field(typeof(Machine), "tur");
			object? value4 = fieldInfo4.GetValue(__instance);
			Turret val4 = (Turret)((value4 is Turret) ? value4 : null);
			FieldInfo fieldInfo5 = AccessTools.Field(typeof(Machine), "sc");
			object? value5 = fieldInfo5.GetValue(__instance);
			Streetcleaner val5 = (Streetcleaner)((value5 is Streetcleaner) ? value5 : null);
			FieldInfo fieldInfo6 = AccessTools.Field(typeof(Machine), "gm");
			object? value6 = fieldInfo6.GetValue(__instance);
			Gutterman val6 = (Gutterman)((value6 is Gutterman) ? value6 : null);
			FieldInfo fieldInfo7 = AccessTools.Field(typeof(Machine), "mf");
			object? value7 = fieldInfo7.GetValue(__instance);
			Mindflayer val7 = (Mindflayer)((value7 is Mindflayer) ? value7 : null);
			FieldInfo fieldInfo8 = AccessTools.Field(typeof(Machine), "min");
			object? value8 = fieldInfo8.GetValue(__instance);
			Minotaur val8 = (Minotaur)((value8 is Minotaur) ? value8 : null);
			FieldInfo fieldInfo9 = AccessTools.Field(typeof(Machine), "sisy");
			object? value9 = fieldInfo9.GetValue(__instance);
			Sisyphus val9 = (Sisyphus)((value9 is Sisyphus) ? value9 : null);
			FieldInfo fieldInfo10 = AccessTools.Field(typeof(Machine), "parryFramesLeft");
			int valueOrDefault = (fieldInfo10.GetValue(__instance) as int?).GetValueOrDefault();
			FieldInfo fieldInfo11 = AccessTools.Field(typeof(Machine), "parryFramesOnPartial");
			bool valueOrDefault2 = (fieldInfo11.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo12 = AccessTools.Field(typeof(Machine), "bsm");
			object? value10 = fieldInfo12.GetValue(__instance);
			BloodsplatterManager val10 = (BloodsplatterManager)((value10 is BloodsplatterManager) ? value10 : null);
			FieldInfo fieldInfo13 = AccessTools.Field(typeof(Machine), "symbiotic");
			bool valueOrDefault3 = (fieldInfo13.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo14 = AccessTools.Field(typeof(Machine), "gz");
			object? value11 = fieldInfo14.GetValue(__instance);
			GoreZone val11 = (GoreZone)((value11 is GoreZone) ? value11 : null);
			FieldInfo fieldInfo15 = AccessTools.Field(typeof(Machine), "chestHP");
			float? num = fieldInfo15.GetValue(__instance) as float?;
			FieldInfo fieldInfo16 = AccessTools.Field(typeof(Machine), "noheal");
			bool valueOrDefault4 = (fieldInfo16.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo17 = AccessTools.Field(typeof(Machine), "aud");
			object? value12 = fieldInfo17.GetValue(__instance);
			AudioSource val12 = (AudioSource)((value12 is AudioSource) ? value12 : null);
			FieldInfo fieldInfo18 = AccessTools.Field(typeof(Machine), "scalc");
			object? value13 = fieldInfo18.GetValue(__instance);
			StyleCalculator val13 = (StyleCalculator)((value13 is StyleCalculator) ? value13 : null);
			string text = "";
			bool flag = false;
			bool flag2 = false;
			float num2 = multiplier;
			GameObject val14 = null;
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)__instance).GetComponent<EnemyIdentifier>();
			}
			if (force != Vector3.zero && !__instance.limp && (Object)(object)val2 == (Object)null && ((Object)(object)val3 == (Object)null || !val3.inIntro) && ((Object)(object)val4 == (Object)null || !val4.lodged || val.hitter == "heavypunch" || val.hitter == "railcannon" || val.hitter == "cannonball" || val.hitter == "hammer"))
			{
				if (Object.op_Implicit((Object)(object)val4) && val4.lodged)
				{
					val4.CancelAim(true);
					val4.Unlodge();
				}
				__instance.KnockBack(force / 100f);
				if (val.hitter == "heavypunch" || (Object.op_Implicit((Object)(object)__instance.gc) && !__instance.gc.onGround && val.hitter == "cannonball"))
				{
					val.useBrakes = false;
				}
				else
				{
					val.useBrakes = true;
				}
			}
			if ((Object)(object)val3 != (Object)null && val3.secondEncounter && val.hitter == "heavypunch")
			{
				val3.InstaEnrage();
			}
			if ((Object)(object)val5 != (Object)null && (Object)(object)target.gameObject == (Object)(object)val5.canister && !val5.canisterHit && val.hitter == "revolver")
			{
				if (!InvincibleEnemies.Enabled && !val.blessed)
				{
					val5.canisterHit = true;
				}
				if (!val.dead && !InvincibleEnemies.Enabled && !val.blessed)
				{
					MonoSingleton<StyleHUD>.Instance.AddPoints(200, "ultrakill.instakill", sourceWeapon, val, -1, "", "");
				}
				MonoSingleton<TimeController>.Instance.ParryFlash();
				((MonoBehaviour)__instance).Invoke("CanisterExplosion", 0.1f);
				return;
			}
			if ((Object)(object)val4 != (Object)null && val4.aiming && (val.hitter == "revolver" || val.hitter == "coin") && val4.interruptables.Contains(target.transform))
			{
				val4.Interrupt();
			}
			if (Object.op_Implicit((Object)(object)val6))
			{
				if (val6.hasShield && !val.dead && (val.hitter == "heavypunch" || val.hitter == "hammer"))
				{
					val6.ShieldBreak(true, true);
				}
				if (val6.hasShield)
				{
					multiplier /= 1.5f;
				}
				if (val6.fallen && !val6.exploded && val.hitter == "ground slam")
				{
					val6.Explode();
					MonoSingleton<NewMovement>.Instance.Launch(Vector3.up * 750f, 8f, false);
				}
			}
			if (Object.op_Implicit((Object)(object)val7) && val7.dying && (val.hitter == "heavypunch" || val.hitter == "hammer"))
			{
				val7.DeadLaunch(force);
			}
			if (val.hitter == "punch")
			{
				bool flag3 = __instance.parryables != null && __instance.parryables.Count > 0 && __instance.parryables.Contains(target.transform);
				if (__instance.parryable || (__instance.partiallyParryable && (flag3 || (valueOrDefault > 0 && valueOrDefault2))))
				{
					__instance.parryable = false;
					__instance.partiallyParryable = false;
					__instance.parryables.Clear();
					if (InvincibleEnemies.Enabled || !val.blessed)
					{
					}
					MonoSingleton<FistControl>.Instance.currentPunch.Parry(false, val, "");
					if ((Object)(object)val2 != (Object)null && __instance.health > 0f)
					{
						if (!val2.enraged)
						{
							val2.Knockdown(true, fromExplosion);
						}
						else
						{
							val2.Enrage();
						}
					}
					else
					{
						((Component)__instance).SendMessage("GotParried", (SendMessageOptions)1);
					}
				}
				else
				{
					fieldInfo11.SetValue(__instance, flag3);
					fieldInfo10.SetValue(__instance, MonoSingleton<FistControl>.Instance.currentPunch.activeFrames);
				}
			}
			else if (Object.op_Implicit((Object)(object)val8) && val8.ramTimer > 0f && val.hitter == "ground slam")
			{
				val8.GotSlammed();
			}
			if (Object.op_Implicit((Object)(object)val9) && num2 > 0f)
			{
				if (val.burners.Count > 0)
				{
					if (val.hitter != "fire")
					{
						if (num2 <= 0.5f)
						{
							val14 = val10.GetGore((GoreType)1, val, fromExplosion);
							val9.PlayHurtSound(1);
						}
						else
						{
							val14 = val10.GetGore((GoreType)0, val, fromExplosion);
							val9.PlayHurtSound(2);
						}
					}
					else
					{
						val9.PlayHurtSound(0);
					}
				}
				else if (val.hitter != "fire")
				{
					val14 = val10.GetGore((GoreType)5, val, fromExplosion);
				}
			}
			float num3 = 0f;
			if (target.gameObject.CompareTag("Head"))
			{
				num3 = 1f;
			}
			else if (target.gameObject.CompareTag("Limb") || target.gameObject.CompareTag("EndLimb"))
			{
				num3 = 0.5f;
			}
			num2 = multiplier + num3 * multiplier * critMultiplier;
			if (num3 == 0f && (val.hitter == "shotgunzone" || val.hitter == "hammerzone"))
			{
				if (__instance.parryable || (!((Object)(object)target.gameObject != (Object)(object)__instance.chest) && !(__instance.health - num2 > 0f)))
				{
					if (!__instance.parryable)
					{
						goto IL_0a5c;
					}
					if (!((Object)(object)target.gameObject == (Object)(object)__instance.chest))
					{
						Vector3 playerVelocity = MonoSingleton<PlayerTracker>.Instance.GetPlayerVelocity(false);
						if (!(((Vector3)(ref playerVelocity)).magnitude > 18f))
						{
							goto IL_0a5c;
						}
					}
					goto IL_0a90;
				}
				num2 = 0f;
			}
			goto IL_0b29;
			IL_0b29:
			if (Object.op_Implicit((Object)(object)val9) && !__instance.limp && val.hitter == "fire" && __instance.health > 0f && __instance.health - num2 < 0.01f && !val.isGasolined)
			{
				num2 = __instance.health - 0.01f;
			}
			if (val.blessed || !InvincibleEnemies.Enabled)
			{
			}
			if (!Object.op_Implicit((Object)(object)val14) && val.hitter != "fire" && num2 > 0f)
			{
				if ((num3 == 1f && (num2 >= 1f || __instance.health <= 0f)) || val.hitter == "hammer")
				{
					val14 = val10.GetGore((GoreType)0, val, fromExplosion);
				}
				else if (((num2 >= 1f || __instance.health <= 0f) && val.hitter != "explosion") || (val.hitter == "explosion" && target.gameObject.CompareTag("EndLimb")))
				{
					val14 = ((!target.gameObject.CompareTag("Body")) ? val10.GetGore((GoreType)1, val, fromExplosion) : val10.GetGore((GoreType)2, val, fromExplosion));
				}
				else if (val.hitter != "explosion")
				{
					val14 = val10.GetGore((GoreType)3, val, fromExplosion);
				}
			}
			if (!__instance.limp)
			{
				flag2 = true;
				string text2 = target.gameObject.tag.ToLower();
				if (text2 == "endlimb")
				{
					text2 = "limb";
				}
				text = text2;
			}
			if (__instance.health <= 0f)
			{
				if (valueOrDefault3)
				{
					if ((Object)(object)val2 != (Object)null && !val2.downed && __instance.symbiote.health > 0f)
					{
						val2.downed = true;
						val2.Down(fromExplosion);
						((MonoBehaviour)__instance).Invoke("StartHealing", 3f);
					}
					else if ((Object)(object)val9 != (Object)null && !val9.downed && __instance.symbiote.health > 0f)
					{
						val9.downed = true;
						val9.Knockdown(((Component)__instance).transform.position + ((Component)__instance).transform.forward);
						((MonoBehaviour)__instance).Invoke("StartHealing", 3f);
					}
					else if (__instance.symbiote.health <= 0f)
					{
						fieldInfo13.SetValue(__instance, false);
						if (!__instance.limp)
						{
							__instance.GoLimp(fromExplosion);
						}
					}
				}
				else
				{
					if (!__instance.limp)
					{
						__instance.GoLimp(fromExplosion);
					}
					if (MonoSingleton<BloodsplatterManager>.Instance.goreOn && !target.gameObject.CompareTag("EndLimb"))
					{
						float num4 = 1f;
						if (val.hitter == "shotgun" || val.hitter == "shotgunzone" || val.hitter == "explosion")
						{
							num4 = 0.5f;
						}
						string tag = target.gameObject.tag;
						if (!(tag == "Head"))
						{
							if (tag == "Limb")
							{
								for (int i = 0; (float)i < 4f * num4; i++)
								{
									GameObject gib = val10.GetGib((BSType)13);
									if (Object.op_Implicit((Object)(object)gib) && Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)val11.gibZone))
									{
										__instance.ReadyGib(gib, target);
									}
								}
								if (target.transform.childCount > 0 && __instance.dismemberment)
								{
									Transform child = target.transform.GetChild(0);
									CharacterJoint[] componentsInChildren = target.GetComponentsInChildren<CharacterJoint>();
									if (componentsInChildren.Length != 0)
									{
										CharacterJoint[] array = componentsInChildren;
										EnemyIdentifierIdentifier val16 = default(EnemyIdentifierIdentifier);
										foreach (CharacterJoint val15 in array)
										{
											if (((MapInfoBase)StockMapInfo.Instance).removeGibsWithoutAbsorbers && ((Component)val15).TryGetComponent<EnemyIdentifierIdentifier>(ref val16))
											{
												val16.SetupForHellBath();
											}
											Object.Destroy((Object)(object)val15);
										}
									}
									CharacterJoint component = target.GetComponent<CharacterJoint>();
									if ((Object)(object)component != (Object)null)
									{
										((Joint)component).connectedBody = null;
										Object.Destroy((Object)(object)component);
									}
									target.transform.position = child.position;
									target.transform.SetParent(child);
									child.SetParent(val11.gibZone);
									Object.Destroy((Object)(object)target.GetComponent<Rigidbody>());
								}
							}
						}
						else
						{
							for (int k = 0; (float)k < 6f * num4; k++)
							{
								GameObject gib2 = val10.GetGib((BSType)10);
								if (Object.op_Implicit((Object)(object)gib2) && Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)val11.gibZone))
								{
									__instance.ReadyGib(gib2, target);
								}
							}
							for (int l = 0; (float)l < 4f * num4; l++)
							{
								GameObject gib3 = val10.GetGib((BSType)9);
								if (Object.op_Implicit((Object)(object)gib3) && Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)val11.gibZone))
								{
									__instance.ReadyGib(gib3, target);
								}
							}
							for (int m = 0; (float)m < 2f * num4; m++)
							{
								GameObject gib4 = val10.GetGib((BSType)11);
								if (Object.op_Implicit((Object)(object)gib4) && Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)val11.gibZone))
								{
									__instance.ReadyGib(gib4, target);
								}
								gib4 = val10.GetGib((BSType)12);
								if (Object.op_Implicit((Object)(object)gib4) && Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)val11.gibZone))
								{
									__instance.ReadyGib(gib4, target);
								}
							}
						}
					}
					if (__instance.dismemberment)
					{
						if (!target.gameObject.CompareTag("Body"))
						{
							Collider val17 = default(Collider);
							if (target.TryGetComponent<Collider>(ref val17))
							{
								Object.Destroy((Object)(object)val17);
							}
							target.transform.localScale = Vector3.zero;
						}
						else if ((Object)(object)target.gameObject == (Object)(object)__instance.chest && (Object)(object)val3 == (Object)null && (Object)(object)val5 == (Object)null && (num - num2 <= 0f || val.hitter == "shotgunzone" || val.hitter == "hammerzone"))
						{
							CharacterJoint[] componentsInChildren2 = target.GetComponentsInChildren<CharacterJoint>();
							if (componentsInChildren2.Length != 0)
							{
								CharacterJoint[] array2 = componentsInChildren2;
								EnemyIdentifierIdentifier val19 = default(EnemyIdentifierIdentifier);
								foreach (CharacterJoint val18 in array2)
								{
									if ((Object)(object)((Component)val18).transform.parent.parent == (Object)(object)__instance.chest.transform)
									{
										if (((MapInfoBase)StockMapInfo.Instance).removeGibsWithoutAbsorbers && ((Component)val18).TryGetComponent<EnemyIdentifierIdentifier>(ref val19))
										{
											val19.SetupForHellBath();
										}
										Object.Destroy((Object)(object)val18);
										((Component)val18).transform.parent = null;
									}
								}
							}
							if (MonoSingleton<BloodsplatterManager>.Instance.goreOn)
							{
								for (int num5 = 0; num5 < 2; num5++)
								{
									GameObject gib5 = val10.GetGib((BSType)13);
									if (Object.op_Implicit((Object)(object)gib5) && Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)val11.gibZone))
									{
										__instance.ReadyGib(gib5, target);
									}
								}
							}
							GameObject gore = val10.GetGore((GoreType)0, val, fromExplosion);
							gore.transform.position = target.transform.position;
							gore.transform.SetParent(val11.goreZone, true);
							target.transform.localScale = Vector3.zero;
						}
					}
				}
				if (__instance.limp)
				{
					Rigidbody componentInParent = target.GetComponentInParent<Rigidbody>();
					if ((Object)(object)componentInParent != (Object)null)
					{
						componentInParent.AddForce(force);
					}
				}
			}
			if ((Object)(object)val14 != (Object)null)
			{
				if (!Object.op_Implicit((Object)(object)val11))
				{
					val11 = GoreZone.ResolveGoreZone(((Component)__instance).transform);
				}
				Collider val20 = default(Collider);
				if (__instance.thickLimbs && target.TryGetComponent<Collider>(ref val20))
				{
					val14.transform.position = val20.ClosestPoint(((Component)MonoSingleton<NewMovement>.Instance).transform.position);
				}
				else
				{
					val14.transform.position = target.transform.position;
				}
				if (val.hitter == "drill")
				{
					Transform transform = val14.transform;
					transform.localScale *= 2f;
				}
				if ((Object)(object)val11 != (Object)null && (Object)(object)val11.goreZone != (Object)null)
				{
					val14.transform.SetParent(val11.goreZone, true);
				}
				Bloodsplatter component2 = val14.GetComponent<Bloodsplatter>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					CollisionModule collision = ((Component)component2).GetComponent<ParticleSystem>().collision;
					if (val.hitter == "shotgun" || val.hitter == "shotgunzone" || val.hitter == "explosion")
					{
						if (Random.Range(0f, 1f) > 0.5f)
						{
							((CollisionModule)(ref collision)).enabled = false;
						}
						component2.hpAmount = 3;
					}
					else if (val.hitter == "nail")
					{
						component2.hpAmount = 1;
						AudioSource component3 = ((Component)component2).GetComponent<AudioSource>();
						component3.volume *= 0.8f;
					}
					if (!valueOrDefault4)
					{
						component2.GetReady();
					}
				}
			}
			if ((__instance.health > 0f || valueOrDefault3) && __instance.hurtSounds.Length != 0 && !val.blessed)
			{
				if ((Object)(object)val12 == (Object)null)
				{
					val12 = ((Component)__instance).GetComponent<AudioSource>();
				}
				val12.clip = __instance.hurtSounds[Random.Range(0, __instance.hurtSounds.Length)];
				if (Object.op_Implicit((Object)(object)val4))
				{
					val12.volume = 0.85f;
				}
				else if (Object.op_Implicit((Object)(object)val8))
				{
					val12.volume = 1f;
				}
				else
				{
					val12.volume = 0.5f;
				}
				if ((Object)(object)val2 != (Object)null)
				{
					val12.pitch = Random.Range(0.85f, 1.35f);
				}
				else
				{
					val12.pitch = Random.Range(0.9f, 1.1f);
				}
				val12.priority = 12;
				val12.Play();
			}
			if (num2 == 0f || val.puppet)
			{
				flag2 = false;
			}
			if (!flag2 || !(val.hitter != "enemy"))
			{
				return;
			}
			if ((Object)(object)val13 == (Object)null)
			{
				val13 = MonoSingleton<StyleCalculator>.Instance;
			}
			if (__instance.health <= 0f && !valueOrDefault3 && ((Object)(object)val3 == (Object)null || !val3.dontDie) && (!val.flying || Object.op_Implicit((Object)(object)val7)))
			{
				flag = true;
				if (Object.op_Implicit((Object)(object)__instance.gc) && !__instance.gc.onGround)
				{
					if (val.hitter == "explosion" || val.hitter == "ffexplosion" || val.hitter == "railcannon")
					{
						val13.shud.AddPoints(120, "ultrakill.fireworks", sourceWeapon, val, -1, "", "");
					}
					else if (val.hitter == "ground slam")
					{
						val13.shud.AddPoints(160, "ultrakill.airslam", sourceWeapon, val, -1, "", "");
					}
					else if (val.hitter != "deathzone")
					{
						val13.shud.AddPoints(50, "ultrakill.airshot", sourceWeapon, val, -1, "", "");
					}
				}
			}
			else if (__instance.health > 0f && Object.op_Implicit((Object)(object)__instance.gc) && !__instance.gc.onGround && (val.hitter == "explosion" || val.hitter == "ffexplosion" || val.hitter == "railcannon"))
			{
				val13.shud.AddPoints(20, "ultrakill.fireworksweak", sourceWeapon, val, -1, "", "");
			}
			if (val.hitter != "secret")
			{
				if (__instance.bigKill)
				{
					val13.HitCalculator(val.hitter, "spider", text, flag, val, sourceWeapon);
				}
				else
				{
					val13.HitCalculator(val.hitter, "machine", text, flag, val, sourceWeapon);
				}
			}
			return;
			IL_0a5c:
			if (__instance.partiallyParryable && __instance.parryables != null && __instance.parryables.Contains(target.transform))
			{
				goto IL_0a90;
			}
			goto IL_0b29;
			IL_0a90:
			num2 *= 1.5f;
			__instance.parryable = false;
			__instance.partiallyParryable = false;
			__instance.parryables.Clear();
			MonoSingleton<NewMovement>.Instance.Parry(val, "");
			if ((Object)(object)val2 != (Object)null && __instance.health - num2 > 0f)
			{
				if (!val2.enraged)
				{
					val2.Knockdown(true, fromExplosion);
				}
				else
				{
					val2.Enrage();
				}
			}
			else
			{
				((Component)__instance).SendMessage("GotParried", (SendMessageOptions)1);
			}
			goto IL_0b29;
		}
	}
	[HarmonyPatch(typeof(SpiderBody), "GetHurt")]
	public static class SpiderGetHurtPatch
	{
		public static bool Prefix(ref GameObject target, ref Vector3 force, ref Vector3 hitPoint, ref float multiplier, ref GameObject sourceWeapon, SpiderBody __instance)
		{
			try
			{
				if (multiplier >= 999f)
				{
					return true;
				}
				if (RankChecker.IsRanked())
				{
					return true;
				}
				AdjustedMethod(ref target, ref force, ref hitPoint, ref multiplier, ref sourceWeapon, __instance);
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error in SpiderGetHurtPatch: " + ex.Message + "\n" + ex.StackTrace));
				return true;
			}
		}

		public static void AdjustedMethod(ref GameObject target, ref Vector3 force, ref Vector3 hitPoint, ref float multiplier, ref GameObject sourceWeapon, SpiderBody __instance)
		{
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: 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_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07db: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0732: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo fieldInfo = AccessTools.Field(typeof(SpiderBody), "eid");
			object? value = fieldInfo.GetValue(__instance);
			EnemyIdentifier val = (EnemyIdentifier)((value is EnemyIdentifier) ? value : null);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(SpiderBody), "gz");
			object? value2 = fieldInfo2.GetValue(__instance);
			GoreZone val2 = (GoreZone)((value2 is GoreZone) ? value2 : null);
			FieldInfo fieldInfo3 = AccessTools.Field(typeof(SpiderBody), "currentDrip");
			object? value3 = fieldInfo3.GetValue(__instance);
			GameObject val3 = (GameObject)((value3 is GameObject) ? value3 : null);
			FieldInfo fieldInfo4 = AccessTools.Field(typeof(SpiderBody), "scalc");
			object? value4 = fieldInfo4.GetValue(__instance);
			StyleCalculator val4 = (StyleCalculator)((value4 is StyleCalculator) ? value4 : null);
			FieldInfo fieldInfo5 = AccessTools.Field(typeof(SpiderBody), "parryable");
			bool valueOrDefault = (fieldInfo5.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo6 = AccessTools.Field(typeof(SpiderBody), "currentExplosion");
			object? value5 = fieldInfo6.GetValue(__instance);
			GameObject val5 = (GameObject)((value5 is GameObject) ? value5 : null);
			FieldInfo fieldInfo7 = AccessTools.Field(typeof(SpiderBody), "beamExplosion");
			object? value6 = fieldInfo7.GetValue(__instance);
			AssetReference val6 = (AssetReference)((value6 is AssetReference) ? value6 : null);
			FieldInfo fieldInfo8 = AccessTools.Field(typeof(SpiderBody), "parryFramesLeft");
			int? num = fieldInfo8.GetValue(__instance) as int?;
			FieldInfo fieldInfo9 = AccessTools.Field(typeof(SpiderBody), "maxHealth");
			float? num2 = fieldInfo9.GetValue(__instance) as float?;
			FieldInfo fieldInfo10 = AccessTools.Field(typeof(SpiderBody), "ensims");
			EnemySimplifier[] array = fieldInfo10.GetValue(__instance) as EnemySimplifier[];
			bool flag = false;
			float health = __instance.health;
			if (hitPoint == Vector3.zero)
			{
				hitPoint = target.transform.position;
			}
			bool goreOn = MonoSingleton<BloodsplatterManager>.Instance.goreOn;
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)__instance).GetComponent<EnemyIdentifier>();
			}
			if (val.hitter != "fire")
			{
				if (!val.sandified && !val.blessed)
				{
					GameObject val7 = Object.Instantiate<GameObject>(MonoSingleton<BloodsplatterManager>.Instance.GetGore((GoreType)3, val, false), hitPoint, Quaternion.identity);
					if (Object.op_Implicit((Object)(object)val7))
					{
						Bloodsplatter component = val7.GetComponent<Bloodsplatter>();
						val7.transform.SetParent(val2.goreZone, true);
						if (val.hitter == "drill")
						{
							Transform transform = val7.transform;
							transform.localScale *= 2f;
						}
						if (__instance.health > 0f)
						{
							component.GetReady();
						}
						if (val.hitter == "nail")
						{
							component.hpAmount = 3;
							AudioSource component2 = ((Component)component).GetComponent<AudioSource>();
							component2.volume *= 0.8f;
						}
						else if (multiplier >= 1f)
						{
							component.hpAmount = 30;
						}
						if (goreOn)
						{
							val7.GetComponent<ParticleSystem>().Play();
						}
					}
					if (val.hitter != "shotgun" && val.hitter != "drill" && ((Component)__instance).gameObject.activeInHierarchy)
					{
						if ((Object)(object)__instance.dripBlood != (Object)null)
						{
							val3 = Object.Instantiate<GameObject>(__instance.dripBlood, hitPoint, Quaternion.identity);
						}
						if (Object.op_Implicit((Object)(object)val3))
						{
							val3.transform.parent = ((Component)__instance).transform;
							val3.transform.LookAt(((Component)__instance).transform);
							val3.transform.Rotate(180f, 180f, 180f);
							if (goreOn)
							{
								val3.GetComponent<ParticleSystem>().Play();
							}
						}
					}
				}
				else
				{
					Object.Instantiate<GameObject>(MonoSingleton<BloodsplatterManager>.Instance.GetGore((GoreType)3, val, false), hitPoint, Quaternion.identity);
				}
			}
			if (!val.dead)
			{
				if (val.blessed || !InvincibleEnemies.Enabled)
				{
				}
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = MonoSingleton<StyleCalculator>.Instance;
				}
				if (__instance.health <= 0f)
				{
					flag = true;
				}
				if (((val.hitter == "shotgunzone" || val.hitter == "hammerzone") && valueOrDefault) || val.hitter == "punch")
				{
					if (valueOrDefault)
					{
						fieldInfo5.SetValue(__instance, false);
						MonoSingleton<FistControl>.Instance.currentPunch.Parry(false, val, "");
						val5 = Object.Instantiate<GameObject>(AddressablesExtensions.ToAsset(val6), ((Component)__instance).transform.position, Quaternion.identity);
						if (InvincibleEnemies.Enabled || !val.blessed)
						{
						}
						Explosion[] componentsInChildren = val5.GetComponentsInChildren<Explosion>();
						foreach (Explosion val8 in componentsInChildren)
						{
							val8.speed *= val.totalDamageModifier;
							val8.maxSize *= 1.75f * val.totalDamageModifier;
							val8.damage = Mathf.RoundToInt(50f * val.totalDamageModifier);
							val8.canHit = (AffectedSubjects)2;
							val8.friendlyFire = true;
						}
						if ((Object)(object)__instance.currentEnrageEffect == (Object)null)
						{
							((MonoBehaviour)__instance).CancelInvoke("BeamFire");
							((MonoBehaviour)__instance).Invoke("StopWaiting", 1f);
							Object.Destroy((Object)(object)__instance.currentCE);
						}
						fieldInfo8.SetValue(__instance, 0);
					}
					else
					{
						fieldInfo8.SetValue(__instance, MonoSingleton<FistControl>.Instance.currentPunch.activeFrames);
					}
				}
				if (multiplier != 0f)
				{
					val4.HitCalculator(val.hitter, "spider", "", flag, val, sourceWeapon);
				}
				if (health >= num2 / 2f && __instance.health < num2 / 2f)
				{
					if (array == null || array.Length == 0)
					{
						array = ((Component)__instance).GetComponentsInChildren<EnemySimplifier>();
					}
					Object.Instantiate<GameObject>(__instance.woundedParticle, ((Component)__instance).transform.position, Quaternion.identity);
					if (!val.puppet)
					{
						EnemySimplifier[] array2 = array;
						foreach (EnemySimplifier val9 in array2)
						{
							if (!val9.ignoreCustomColor)
							{
								val9.ChangeMaterialNew((MaterialState)0, __instance.woundedMaterial);
								val9.ChangeMaterialNew((MaterialState)2, __instance.woundedEnrageMaterial);
							}
						}
					}
				}
				if (Object.op_Implicit((Object)(object)__instance.hurtSound) && health > 0f)
				{
					OneShotAudioExtension.PlayClipAtPoint(__instance.hurtSound, MonoSingleton<AudioMixerController>.Instance.goreGroup, ((Component)__instance).transform.position, 12, 1f, 0.75f, Random.Range(0.85f, 1.35f), (AudioRolloffMode)1, 1f, 100f);
				}
				if (__instance.health <= 0f && !val.dead)
				{
					__instance.Die();
				}
			}
			else if (val.hitter == "ground slam")
			{
				__instance.BreakCorpse();
			}
		}
	}
	[HarmonyPatch(typeof(Statue), "GetHurt")]
	public static class StatusGetHurtPatch
	{
		public static bool Prefix(ref GameObject target, ref Vector3 force, ref float multiplier, ref float critMultiplier, ref Vector3 hurtPos, ref GameObject sourceWeapon, ref bool fromExplosion, Statue __instance)
		{
			try
			{
				if (multiplier >= 999f)
				{
					return true;
				}
				if (RankChecker.IsRanked())
				{
					return true;
				}
				AdjustedMethod(ref target, ref force, ref multiplier, ref critMultiplier, ref hurtPos, ref sourceWeapon, ref fromExplosion, __instance);
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error checking rank: " + ex.Message));
				return true;
			}
		}

		public static void AdjustedMethod(ref GameObject target, ref Vector3 force, ref float multiplier, ref float critMultiplier, ref Vector3 hurtPos, ref GameObject sourceWeapon, ref bool fromExplosion, Statue __instance)
		{
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0999: Unknown result type (might be due to invalid IL or missing references)
			//IL_099e: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0835: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dcb: Unknown result type (might be due to invalid IL or missing references)
			//IL_116d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1172: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo fieldInfo = AccessTools.Field(typeof(Statue), "eid");
			object? value = fieldInfo.GetValue(__instance);
			EnemyIdentifier val = (EnemyIdentifier)((value is EnemyIdentifier) ? value : null);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(Statue), "massDying");
			bool valueOrDefault = (fieldInfo2.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo3 = AccessTools.Field(typeof(Statue), "bsm");
			object? value2 = fieldInfo3.GetValue(__instance);
			BloodsplatterManager val2 = (BloodsplatterManager)((value2 is BloodsplatterManager) ? value2 : null);
			FieldInfo fieldInfo4 = AccessTools.Field(typeof(Statue), "mass");
			object? value3 = fieldInfo4.GetValue(__instance);
			Mass val3 = (Mass)((value3 is Mass) ? value3 : null);
			FieldInfo fieldInfo5 = AccessTools.Field(typeof(Statue), "gz");
			object? value4 = fieldInfo5.GetValue(__instance);
			GoreZone val4 = (GoreZone)((value4 is GoreZone) ? value4 : null);
			FieldInfo fieldInfo6 = AccessTools.Field(typeof(Statue), "gc");
			object? value5 = fieldInfo6.GetValue(__instance);
			GroundCheckEnemy val5 = (GroundCheckEnemy)((value5 is GroundCheckEnemy) ? value5 : null);
			FieldInfo fieldInfo7 = AccessTools.Field(typeof(Statue), "noheal");
			bool valueOrDefault2 = (fieldInfo7.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo8 = AccessTools.Field(typeof(Statue), "parryFramesLeft");
			int valueOrDefault3 = (fieldInfo8.GetValue(__instance) as int?).GetValueOrDefault();
			FieldInfo fieldInfo9 = AccessTools.Field(typeof(Statue), "parryFramesOnPartial");
			bool valueOrDefault4 = (fieldInfo9.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo10 = AccessTools.Field(typeof(Statue), "aud");
			object? value6 = fieldInfo10.GetValue(__instance);
			AudioSource val6 = (AudioSource)((value6 is AudioSource) ? value6 : null);
			FieldInfo fieldInfo11 = AccessTools.Field(typeof(Statue), "scalc");
			object? value7 = fieldInfo11.GetValue(__instance);
			StyleCalculator val7 = (StyleCalculator)((value7 is StyleCalculator) ? value7 : null);
			string text = "";
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			GameObject val8 = null;
			float health = __instance.health;
			if (valueOrDefault || (Object)(object)val == (Object)null)
			{
				return;
			}
			float num;
			if (target.gameObject.CompareTag("Head"))
			{
				num = 1f * multiplier + multiplier * critMultiplier;
				if (__instance.extraDamageZones.Count > 0 && __instance.extraDamageZones.Contains(target))
				{
					num *= __instance.extraDamageMultiplier;
					flag3 = true;
				}
				if (val.blessed || !InvincibleEnemies.Enabled)
				{
				}
				if (val.hitter != "fire" && num > 0f)
				{
					val8 = ((!(num >= 1f) && !(__instance.health <= 0f)) ? val2.GetGore((GoreType)3, val, fromExplosion) : val2.GetGore((GoreType)0, val, fromExplosion));
				}
				if (!__instance.limp)
				{
					flag2 = true;
					text = "head";
				}
				if (__instance.health <= 0f && !__instance.limp)
				{
					__instance.GoLimp();
				}
			}
			else
			{
				if (!target.gameObject.CompareTag("Limb") && !target.gameObject.CompareTag("EndLimb"))
				{
					num = 1f * multiplier;
					if (val.hitter == "shotgunzone" || val.hitter == "hammerzone")
					{
						if (__instance.parryable || (__instance.partiallyParryable && __instance.parryables != null && __instance.parryables.Contains(target.transform)) || (!((Object)(object)target.gameObject != (Object)(object)__instance.chest) && !(__instance.health - num > 0f)))
						{
							if (!__instance.parryable)
							{
								goto IL_0601;
							}
							if (!((Object)(object)target.gameObject == (Object)(object)__instance.chest))
							{
								Vector3 playerVelocity = MonoSingleton<PlayerTracker>.Instance.GetPlayerVelocity(false);
								if (!(((Vector3)(ref playerVelocity)).magnitude > 18f))
								{
									goto IL_0601;
								}
							}
							goto IL_0632;
						}
						num = 0f;
					}
					goto IL_067b;
				}
				num = 1f * multiplier + 0.5f * multiplier * critMultiplier;
				if (__instance.extraDamageZones.Count > 0 && __instance.extraDamageZones.Contains(target))
				{
					num *= __instance.extraDamageMultiplier;
					flag3 = true;
				}
				if (val.blessed || !InvincibleEnemies.Enabled)
				{
				}
				if (val.hitter != "fire" && num > 0f)
				{
					if (val.hitter == "hammer")
					{
						val8 = val2.GetGore((GoreType)0, val, fromExplosion);
					}
					else if ((num >= 1f && __instance.health > 0f) || (__instance.health <= 0f && val.hitter != "explosion") || (val.hitter == "explosion" && target.gameObject.CompareTag("EndLimb")))
					{
						val8 = val2.GetGore((GoreType)1, val, fromExplosion);
					}
					else if (val.hitter != "explosion")
					{
						val8 = val2.GetGore((GoreType)3, val, fromExplosion);
					}
				}
				if (!__instance.limp)
				{
					flag2 = true;
					text = "limb";
				}
				if (__instance.health <= 0f && !__instance.limp)
				{
					__instance.GoLimp();
				}
			}
			goto IL_0843;
			IL_0632:
			num *= 1.5f;
			__instance.parryable = false;
			__instance.partiallyParryable = false;
			__instance.parryables.Clear();
			MonoSingleton<NewMovement>.Instance.Parry(val, "");
			((Component)__instance).SendMessage("GotParried", (SendMessageOptions)1);
			goto IL_067b;
			IL_0601:
			if (__instance.partiallyParryable && __instance.parryables != null && __instance.parryables.Contains(target.transform))
			{
				goto IL_0632;
			}
			goto IL_067b;
			IL_0843:
			if ((Object)(object)val3 != (Object)null)
			{
				if (val3.spearShot && Object.op_Implicit((Object)(object)val3.tempSpear) && val3.tailHitboxes.Contains(target))
				{
					MassSpear component = val3.tempSpear.GetComponent<MassSpear>();
					if ((Object)(object)component != (Object)null && component.hitPlayer)
					{
						if (num >= 1f || component.spearHealth - num <= 0f)
						{
							GameObject gore = val2.GetGore((GoreType)0, val, fromExplosion);
							AccessTools.Method(typeof(Statue), "ReadyGib", (Type[])null, (Type[])null).Invoke(__instance, new object[2]
							{
								gore,
								((Component)val3.tailEnd.GetChild(0)).gameObject
							});
						}
						component.spearHealth -= num;
					}
				}
				else if (val3.spearShot && !Object.op_Implicit((Object)(object)val3.tempSpear))
				{
					val3.spearShot = false;
				}
			}
			if ((Object)(object)val8 != (Object)null)
			{
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = GoreZone.ResolveGoreZone(((Component)__instance).transform);
				}
				if (hurtPos != Vector3.zero)
				{
					val8.transform.position = hurtPos;
				}
				else
				{
					val8.transform.position = target.transform.position;
				}
				if (val.hitter == "drill")
				{
					Transform transform = val8.transform;
					transform.localScale *= 2f;
				}
				if (__instance.bigBlood)
				{
					Transform transform2 = val8.transform;
					transform2.localScale *= 2f;
				}
				if ((Object)(object)val4 != (Object)null && (Object)(object)val4.goreZone != (Object)null)
				{
					val8.transform.SetParent(val4.goreZone, true);
				}
				Bloodsplatter component2 = val8.GetComponent<Bloodsplatter>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					CollisionModule collision = ((Component)component2).GetComponent<ParticleSystem>().collision;
					if (val.hitter == "shotgun" || val.hitter == "shotgunzone" || val.hitter == "explosion")
					{
						if (Random.Range(0f, 1f) > 0.5f)
						{
							((CollisionModule)(ref collision)).enabled = false;
						}
						component2.hpAmount = 3;
					}
					else if (val.hitter == "nail")
					{
						component2.hpAmount = 1;
						AudioSource component3 = ((Component)component2).GetComponent<AudioSource>();
						component3.volume *= 0.8f;
					}
					if (!valueOrDefault2)
					{
						component2.GetReady();
					}
				}
			}
			if (Object.op_Implicit((Object)(object)val) && val.hitter == "punch")
			{
				bool flag4 = __instance.parryables != null && __instance.parryables.Count > 0 && __instance.parryables.Contains(target.transform);
				if (__instance.parryable || (__instance.partiallyParryable && (flag4 || (valueOrDefault3 > 0 && valueOrDefault4))))
				{
					__instance.parryable = false;
					__instance.partiallyParryable = false;
					__instance.parryables.Clear();
					if (!InvincibleEnemies.Enabled && !val.blessed)
					{
						num = 5f;
					}
					if (val.blessed || !InvincibleEnemies.Enabled)
					{
					}
					MonoSingleton<FistControl>.Instance.currentPunch.Parry(true, val, "");
					((Component)__instance).SendMessage("GotParried", (SendMessageOptions)1);
				}
				else
				{
					fieldInfo9.SetValue(__instance, flag4);
					fieldInfo8.SetValue(__instance, MonoSingleton<FistControl>.Instance.currentPunch.activeFrames);
				}
			}
			if (flag3 && (num >= 1f || (val.hitter == "shotgun" && Random.Range(0f, 1f) > 0.5f) || (val.hitter == "nail" && Random.Range(0f, 1f) > 0.85f)))
			{
				val8 = ((!(__instance.extraDamageMultiplier >= 2f)) ? val2.GetGore((GoreType)1, val, fromExplosion) : val2.GetGore((GoreType)0, val, fromExplosion));
				if (Object.op_Implicit((Object)(object)val8))
				{
					val8.transform.position = target.transform.position;
					if ((Object)(object)val4 != (Object)null && (Object)(object)val4.goreZone != (Object)null)
					{
						val8.transform.SetParent(val4.goreZone, true);
					}
					Bloodsplatter component4 = val8.GetComponent<Bloodsplatter>();
					if (Object.op_Implicit((Object)(object)component4))
					{
						CollisionModule collision2 = ((Component)component4).GetComponent<ParticleSystem>().collision;
						if (val.hitter == "shotgun" || val.hitter == "shotgunzone" || val.hitter == "explosion")
						{
							if (Random.Range(0f, 1f) > 0.5f)
							{
								((CollisionModule)(ref collision2)).enabled = false;
							}
							component4.hpAmount = 3;
						}
						else if (val.hitter == "nail")
						{
							component4.hpAmount = 1;
							AudioSource component5 = ((Component)component4).GetComponent<AudioSource>();
							component5.volume *= 0.8f;
						}
						if (!valueOrDefault2)
						{
							component4.GetReady();
						}
					}
				}
			}
			if (__instance.health > 0f && __instance.hurtSounds.Length != 0 && !val.blessed)
			{
				if ((Object)(object)val6 == (Object)null)
				{
					val6 = ((Component)__instance).GetComponent<AudioSource>();
				}
				val6.clip = __instance.hurtSounds[Random.Range(0, __instance.hurtSounds.Length)];
				val6.volume = 0.75f;
				val6.pitch = Random.Range(0.85f, 1.35f);
				val6.priority = 12;
				val6.Play();
			}
			if (multiplier == 0f || val.puppet)
			{
				flag2 = false;
			}
			if (flag2 && val.hitter != "enemy")
			{
				if ((Object)(object)val7 == (Object)null)
				{
					val7 = MonoSingleton<StyleCalculator>.Instance;
				}
				MinosArm component6 = ((Component)__instance).GetComponent<MinosArm>();
				if (__instance.health <= 0f && !Object.op_Implicit((Object)(object)component6))
				{
					flag = true;
					if (Object.op_Implicit((Object)(object)val5) && !val5.onGround && !val.flying)
					{
						if (val.hitter == "explosion" || val.hitter == "ffexplosion" || val.hitter == "railcannon")
						{
							val7.shud.AddPoints(120, "ultrakill.fireworks", sourceWeapon, val, -1, "", "");
						}
						else if (val.hitter == "ground slam")
						{
							val7.shud.AddPoints(160, "ultrakill.airslam", sourceWeapon, val, -1, "", "");
						}
						else if (val.hitter != "deathzone")
						{
							val7.shud.AddPoints(50, "ultrakill.airshot", sourceWeapon, val, -1, "", "");
						}
					}
				}
				if (val.hitter != "secret" && Object.op_Implicit((Object)(object)val7))
				{
					val7.HitCalculator(val.hitter, "spider", text, flag, val, sourceWeapon);
				}
			}
			if ((!Object.op_Implicit((Object)(object)__instance.woundedMaterial) && !Object.op_Implicit((Object)(object)__instance.woundedModel)) || !(health >= __instance.originalHealth / 2f) || !(__instance.health < __instance.originalHealth / 2f))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)__instance.woundedParticle))
			{
				Object.Instantiate<GameObject>(__instance.woundedParticle, __instance.chest.transform.position, Quaternion.identity);
			}
			if (val.puppet)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)__instance.woundedModel))
			{
				__instance.woundedModel.SetActive(true);
				((Component)__instance.smr).gameObject.SetActive(false);
				return;
			}
			((Renderer)__instance.smr).material = __instance.woundedMaterial;
			EnemySimplifier val9 = default(EnemySimplifier);
			if (((Component)__instance.smr).TryGetComponent<EnemySimplifier>(ref val9))
			{
				val9.ChangeMaterialNew((MaterialState)0, __instance.woundedMaterial);
				val9.ChangeMaterialNew((MaterialState)2, __instance.woundedEnrageMaterial);
			}
			return;
			IL_067b:
			if (__instance.extraDamageZones.Count > 0 && __instance.extraDamageZones.Contains(target))
			{
				num *= __instance.extraDamageMultiplier;
				flag3 = true;
			}
			if (val.blessed || !InvincibleEnemies.Enabled)
			{
			}
			if (val.hitter != "fire" && num > 0f)
			{
				if (val.hitter == "hammer")
				{
					val8 = val2.GetGore((GoreType)0, val, fromExplosion);
				}
				else if ((num >= 1f && __instance.health > 0f) || (__instance.health <= 0f && val.hitter != "explosion") || (val.hitter == "explosion" && target.gameObject.CompareTag("EndLimb")))
				{
					val8 = val2.GetGore((GoreType)2, val, fromExplosion);
				}
				else if (val.hitter != "explosion")
				{
					val8 = val2.GetGore((GoreType)3, val, fromExplosion);
				}
			}
			if (!__instance.limp)
			{
				flag2 = true;
				text = "body";
			}
			if (__instance.health <= 0f)
			{
				if (!__instance.limp)
				{
					__instance.GoLimp();
				}
				if (Object.op_Implicit((Object)(object)target) && (Object)(object)target.GetComponentInParent<Rigidbody>() != (Object)null)
				{
					target.GetComponentInParent<Rigidbody>().AddForce(force);
				}
			}
			goto IL_0843;
		}
	}
	[HarmonyPatch(typeof(Zombie), "GetHurt")]
	public static class ZombieGetHurtPatch
	{
		public static bool Prefix(ref GameObject target, ref Vector3 force, ref float multiplier, ref float critMultiplier, ref GameObject sourceWeapon, ref bool fromExplosion, Zombie __instance)
		{
			try
			{
				if (multiplier >= 999f)
				{
					return true;
				}
				if (RankChecker.IsRanked())
				{
					return true;
				}
				AdjustedMethod(ref target, ref force, ref multiplier, ref critMultiplier, ref sourceWeapon, ref fromExplosion, __instance);
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error checking rank: " + ex.Message));
				return true;
			}
		}

		public static void AdjustedMethod(ref GameObject target, ref Vector3 force, ref float multiplier, ref float critMultiplier, ref GameObject sourceWeapon, ref bool fromExplosion, Zombie __instance)
		{
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08db: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ecc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_096f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0985: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_11cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_1220: Unknown result type (might be due to invalid IL or missing references)
			//IL_1183: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0adb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e55: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo fieldInfo = AccessTools.Field(typeof(Zombie), "eid");
			object? value = fieldInfo.GetValue(__instance);
			EnemyIdentifier val = (EnemyIdentifier)((value is EnemyIdentifier) ? value : null);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(Zombie), "gc");
			object? value2 = fieldInfo2.GetValue(__instance);
			GroundCheckEnemy val2 = (GroundCheckEnemy)((value2 is GroundCheckEnemy) ? value2 : null);
			FieldInfo fieldInfo3 = AccessTools.Field(typeof(Zombie), "bsm");
			object? value3 = fieldInfo3.GetValue(__instance);
			BloodsplatterManager val3 = (BloodsplatterManager)((value3 is BloodsplatterManager) ? value3 : null);
			FieldInfo fieldInfo4 = AccessTools.Field(typeof(Zombie), "gz");
			object? value4 = fieldInfo4.GetValue(__instance);
			GoreZone val4 = (GoreZone)((value4 is GoreZone) ? value4 : null);
			FieldInfo fieldInfo5 = AccessTools.Field(typeof(Zombie), "zm");
			object? value5 = fieldInfo5.GetValue(__instance);
			ZombieMelee val5 = (ZombieMelee)((value5 is ZombieMelee) ? value5 : null);
			FieldInfo fieldInfo6 = AccessTools.Field(typeof(Zombie), "parryFramesLeft");
			int? num = fieldInfo6.GetValue(__instance) as int?;
			FieldInfo fieldInfo7 = AccessTools.Field(typeof(Zombie), "noheal");
			bool valueOrDefault = (fieldInfo7.GetValue(__instance) as bool?).GetValueOrDefault();
			FieldInfo fieldInfo8 = AccessTools.Field(typeof(Zombie), "aud");
			object? value6 = fieldInfo8.GetValue(__instance);
			AudioSource val6 = (AudioSource)((value6 is AudioSource) ? value6 : null);
			FieldInfo fieldInfo9 = AccessTools.Field(typeof(Zombie), "scalc");
			object? value7 = fieldInfo9.GetValue(__instance);
			StyleCalculator val7 = (StyleCalculator)((value7 is StyleCalculator) ? value7 : null);
			FieldInfo fieldInfo10 = AccessTools.Field(typeof(Zombie), "chestHP");
			float? num2 = fieldInfo10.GetValue(__instance) as float?;
			FieldInfo fieldInfo11 = AccessTools.Field(typeof(Zombie), "chestExploded");
			bool valueOrDefault2 = (fieldInfo11.GetValue(__instance) as bool?).GetValueOrDefault();
			string text = "";
			bool flag = false;
			bool flag2 = false;
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)__instance).GetComponent<EnemyIdentifier>();
			}
			if (Object.op_Implicit((Object)(object)val2) && !val2.onGround && val.hitter != "fire")
			{
				multiplier *= 1.5f;
			}
			if (force != Vector3.zero && !__instance.limp)
			{
				__instance.KnockBack(force / 100f);
				if (val.hitter == "heavypunch" || (val.hitter == "cannonball" && Object.op_Implicit((Object)(object)val2) && !val2.onGround))
				{
					val.useBrakes = false;
				}
				else
				{
					val.useBrakes = true;
				}
			}
			if (__instance.chestExploding && __instance.health <= 0f && (target.gameObject.CompareTag("Limb") || target.gameObject.CompareTag("EndLimb")) && (Object)(object)target.GetComponentInParent<EnemyIdentifier>() != (Object)null)
			{
				__instance.ChestExplodeEnd();
			}
			GameObject val8 = null;
			if ((Object)(object)val3 == (Object)null)
			{
				val3 = MonoSingleton<BloodsplatterManager>.Instance;
			}
			if (Object.op_Implicit((Object)(object)val5) && val5.diving)
			{
				val5.CancelAttack();
			}
			if (val.hitter == "punch")
			{
				if (__instance.attacking)
				{
					if (InvincibleEnemies.Enabled || !val.blessed)
					{
					}
					__instance.attacking = false;
					MonoSingleton<FistControl>.Instance.currentPunch.Parry(false, val, "");
				}
				else
				{
					fieldInfo6.SetValue(__instance, MonoSingleton<FistControl>.Instance.currentPunch.activeFrames);
				}
			}
			Vector3 val9;
			float num5;
			if (target.gameObject.CompareTag("Head"))
			{
				float num3 = 1f * multiplier + multiplier * critMultiplier;
				if (val.blessed || !InvincibleEnemies.Enabled)
				{
				}
				if (val.hitter != "fire" && num3 > 0f)
				{
					val8 = ((!(num3 >= 1f) && !(__instance.health <= 0f)) ? val3.GetGore((GoreType)3, val, fromExplosion) : val3.GetGore((GoreType)0, val, fromExplosion));
				}
				val9 = target.transform.position - ((Component)__instance).transform.position;
				Vector3 normalized = ((Vector3)(ref val9)).normalized;
				if (!__instance.limp)
				{
					flag2 = true;
					text = "head";
				}
				if (__instance.health <= 0f)
				{
					if (!__instance.limp)
					{
						__instance.GoLimp();
					}
					if (val.hitter != "fire" && val.hitter != "sawblade")
					{
						float num4 = 1f;
						if (val.hitter == "shotgun" || val.hitter == "shotgunzone")
						{
							num4 = 0.5f;
						}
						else if (val.hitter == "Explosion")
						{
							num4 = 0.25f;
						}
						if ((Object)(object)target.transform.parent != (Object)null && (Object)(object)((Component)target.transform.parent).GetComponentInParent<Rigidbody>() != (Object)null)
						{
							((Component)target.transform.parent).GetComponentInParent<Rigidbody>().AddForce(force * 10f);
						}
						if (MonoSingleton<BloodsplatterManager>.Instance.goreOn && val.hitter != "harpoon")
						{
							AccessTools.Method(typeof(Zombie), "GetGoreZone", (Type[])null, (Type[])null).Invoke(__instance, null);
							for (int i = 0; (float)i < 6f * num4; i++)
							{
								GameObject gib = val3.GetGib((BSType)10);
								AccessTools.Method(typeof(Zombie), "ReadyGib", (Type[])null, (Type[])null).Invoke(__instance, new object[2] { gib, target });
							}
							for (int j = 0; (float)j < 4f * num4; j++)
							{
								GameObject gib2 = val3.GetGib((BSType)9);
								AccessTools.Method(typeof(Zombie), "ReadyGib", (Type[])null, (Type[])null).Invoke(__instance, new object[2] { gib2, target });
							}
							for (int k = 0; (float)k < 2f * num4; k++)
							{
								GameObject gib3 = val3.GetGib((BSType)11);
								AccessTools.Method(typeof(Zombie), "ReadyGib", (Type[])null, (Type[])null).Invoke(__instance, new object[2] { gib3, target });
								gib3 = val3.GetGib((BSType)12);
								AccessTools.Method(typeof(Zombie), "ReadyGib", (Type[])null, (Type[])null).Invoke(__instance, new object[2] { gib3, target });
							}
						}
					}
				}
			}
			else
			{
				if (!target.gameObject.CompareTag("Limb") && !target.gameObject.CompareTag("EndLimb"))
				{
					num5 = multiplier;
					if ((Object)(object)val == (Object)null)
					{
						val = ((Component)__instance).GetComponent<EnemyIdentifier>();
					}
					if (val.hitter == "shotgunzone" || val.hitter == "hammerzone")
					{
						if (!__instance.attacking && ((Object)(object)target.gameObject != (Object)(object)__instance.chest || __instance.health - num5 > 0f))
						{
							num5 = 0f;
						}
						else if (__instance.attacking)
						{
							if (!((Object)(object)target.gameObject == (Object)(object)__instance.chest))
							{
								val9 = val.target.GetVelocity();
								if (!(((Vector3)(ref val9)).magnitude > 18f))
								{
									goto IL_0c07;
								}
							}
							if (!InvincibleEnemies.Enabled && !val.blessed)
							{
								num5 *= 2f;
							}
							MonoSingleton<NewMovement>.Instance.Parry(val, "");
						}
					}
					goto IL_0c07;
				}
				if ((Object)(object)val == (Object)null)
				{
					val = ((Component)__instance).GetComponent<EnemyIdentifier>();
				}
				float num6 = 1f * multiplier + 0.5f * multiplier * critMultiplier;
				if (val.blessed || !InvincibleEnemies.Enabled)
				{
				}
				if (val.hitter != "fire" && num6 > 0f)
				{
					if (val.hitter == "hammer")
					{
						val8 = val3.GetGore((GoreType)0, val, fromExplosion);
					}
					else if (((num6 >= 1f || __instance.health <= 0f) && val.hitter != "explosion") || (val.hitter == "explosion" && target.gameObject.CompareTag("EndLimb")))
					{
						val8 = val3.GetGore((GoreType)1, val, fromExplosion);
					}
					else if (val.hitter != "explosion")
					{
						val8 = val3.GetGore((GoreType)3, val, fromExplosion);
					}
				}
				val9 = target.transform.position - ((Component)__instance).transform.position;
				Vector3 normalized2 = ((Vector3)(ref val9)).normalized;
				if (!__instance.limp)
				{
					flag2 = true;
					text = "limb";
				}
				if (__instance.health <= 0f)
				{
					if (!__instance.limp)
					{
						__instance.GoLimp();
					}
					if (val.hitter == "sawblade")
					{
						if (!valueOrDefault2 && target.transform.position.y > __instance.chest.transform.position.y - 1f)
						{
							__instance.ChestExplosion(true, false);
						}
					}
					else if (val.hitter != "fire" && val.hitter != "harpoon")
					{
						if (MonoSingleton<BloodsplatterManager>.Instance.goreOn && val.hitter != "explosion" && target.gameObject.CompareTag("Limb"))
						{
							float num7 = 1f;
							AccessTools.Method(typeof(Zombie), "GetGoreZone", (Type[])null, (Type[])null).Invoke(__instance, null);
							if (val.hitter == "shotgun" || val.hitter == "shotgunzone")
							{
								num7 = 0.5f;
							}
							for (int l = 0; (float)l < 4f * num7; l++)
							{
								GameObject gib4 = val3.GetGib((BSType)13);
								AccessTools.Method(typeof(Zombie), "ReadyGib", (Type[])null, (Type[])null).Invoke(__instance, new object[2] { gib4, target });
							}
						}
						else
						{
							target.transform.localScale = Vector3.zero;
							target.SetActive(false);
						}
					}
				}
			}
			goto IL_0e63;
			IL_0c07:
			if (val.blessed || !InvincibleEnemies.Enabled)
			{
			}
			if (val.hitter != "fire" && num5 > 0f)
			{
				val8 = ((val.hitter == "hammer") ? val3.GetGore((GoreType)0, val, fromExplosion) : ((!(num5 >= 1f) && !(__instance.health <= 0f)) ? val3.GetGore((GoreType)3, val, fromExplosion) : val3.GetGore((GoreType)2, val, fromExplosion)));
			}
			if (__instance.health <= 0f && (Object)(object)target.gameObject == (Object)(object)__instance.chest && val.hitter != "fire" && ((!(val.hitter == "shotgunzone") && !(val.hitter == "hammerzone") && !(val.hitter == "sawblade")) ? (num2 - num5) : new float?(0f)) <= 0f && val.hitter != "harpoon")
			{
				__instance.ChestExplosion(val.hitter == "sawblade", fromExplosion);
			}
			if (!__instance.limp)
			{
				flag2 = true;
				text = "body";
			}
			if (__instance.health <= 0f)
			{
				if (!__instance.limp)
				{
					__instance.GoLimp();
				}
				if (val.hitter != "sawblade" && (Object)(object)target.GetComponentInParent<Rigidbody>() != (Object)null)
				{
					target.GetComponentInParent<Rigidbody>().AddForce(force * 10f);
				}
			}
			goto IL_0e63;
			IL_0e63:
			if ((Object)(object)val8 != (Object)null)
			{
				AccessTools.Method(typeof(Zombie), "GetGoreZone", (Type[])null, (Type[])null).Invoke(__instance, null);
				val8.transform.position = target.transform.position;
				if (val.hitter == "drill")
				{
					Transform transform = val8.transform;
					transform.localScale *= 2f;
				}
				if ((Object)(object)val4 != (Object)null && (Object)(object)val4.goreZone != (Object)null)
				{
					val8.transform.SetParent(val4.goreZone, true);
				}
				Bloodsplatter component = val8.GetComponent<Bloodsplatter>();
				if (Object.op_Implicit((Object)(object)component))
				{
					CollisionModule collision = ((Component)component).GetComponent<ParticleSystem>().collision;
					if (val.hitter == "shotgun" || val.hitter == "shotgunzone" || val.hitter == "explosion")
					{
						if (Random.Range(0f, 1f) > 0.5f)
						{
							((CollisionModule)(ref collision)).enabled = false;
						}
						component.hpAmount = 3;
					}
					else if (val.hitter == "nail")
					{
						component.hpAmount = 1;
						AudioSource component2 = ((Component)component).GetComponent<AudioSource>();
						component2.volume *= 0.8f;
					}
					if (!valueOrDefault)
					{
						component.GetReady();
					}
				}
			}
			if (__instance.health <= 0f)
			{
				if (val.hitter == "sawblade")
				{
					__instance.Cut(target);
				}
				else if (val.hitter != "harpoon" && val.hitter != "fire")
				{
					if (target.gameObject.CompareTag("Limb"))
					{
						if (target.transform.childCount > 0)
						{
							Transform child = target.transform.GetChild(0);
							CharacterJoint[] componentsInChildren = target.GetComponentsInChildren<CharacterJoint>();
							AccessTools.Method(typeof(Zombie), "GetGoreZone", (Type[])null, (Type[])null).Invoke(__instance, null);
							if (componentsInChildren.Length != 0)
							{
								CharacterJoint[] array = componentsInChildren;
								EnemyIdentifierIdentifier val11 = default(EnemyIdentifierIdentifier);
								foreach (CharacterJoint val10 in array)
								{
									if (((MapInfoBase)StockMapInfo.Instance).removeGibsWithoutAbsorbers && ((Component)val10).TryGetComponent<EnemyIdentifierIdentifier>(ref val11))
									{
										val11.SetupForHellBath();
									}
									((Component)val10).transform.SetParent(((Component)val4).transform);
									Object.Destroy((Object)(object)val10);
								}
							}
							CharacterJoint component3 = target.GetComponent<CharacterJoint>();
							if ((Object)(object)component3 != (Object)null)
							{
								((Joint)component3).connectedBody = null;
								Object.Destroy((Object)(object)component3);
							}
							target.transform.position = child.position;
							target.transform.SetParent(child);
							child.SetParent(((Component)val4).transform, true);
							Object.Destroy((Object)(object)target.GetComponent<Rigidbody>());
						}
						Object.Destroy((Object)(object)target.GetComponent<Collider>());
						target.transform.localScale = Vector3.zero;
						target.gameObject.SetActive(false);
					}
					else if (target.gameObject.CompareTag("EndLimb") || target.gameObject.CompareTag("Head"))
					{
						target.transform.localScale = Vector3.zero;
						target.gameObject.SetActive(false);
					}
				}
			}
			if (__instance.health > 0f && !__instance.limp && __instance.hurtSounds.Length != 0 && !val.blessed && val.hitter != "blocked")
			{
				val6.clip = __instance.hurtSounds[Random.Range(0, __instance.hurtSounds.Length)];
				val6.volume = __instance.hurtSoundVol;
				val6.pitch = Random.Range(0.85f, 1.35f);
				val6.priority = 12;
				val6.Play();
			}
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)__instance).GetComponent<EnemyIdentifier>();
			}
			if (multiplier == 0f || val.puppet)
			{
				flag2 = false;
			}
			if (!flag2 || !(val.hitter != "enemy"))
			{
				return;
			}
			if ((Object)(object)val7 == (Object)null)
			{
				val7 = MonoSingleton<StyleCalculator>.Instance;
			}
			if (__instance.health <= 0f)
			{
				flag = true;
				if (Object.op_Implicit((Object)(object)val2) && !val2.onGround)
				{
					if (val.hitter == "explosion" || val.hitter == "ffexplosion" || val.hitter == "railcannon")
					{
						val7.shud.AddPoints(120, "ultrakill.fireworks", sourceWeapon, val, -1, "", "");
					}
					else if (val.hitter == "ground slam")
					{
						val7.shud.AddPoints(160, "ultrakill.airslam", sourceWeapon, val, -1, "", "");
					}
					else if (val.hitter != "deathzone")
					{
						val7.shud.AddPoints(50, "ultrakill.airshot", sourceWeapon, val, -1, "", "");
					}
				}
			}
			if (val.hitter != "secret" && Object.op_Implicit((Object)(object)val7))
			{
				val7.HitCalculator(val.hitter, "zombie", text, flag, val, sourceWeapon);
			}
			if (flag && val.hitter != "fire")
			{
				Flammable componentInChildren = ((Component)__instance).GetComponentInChildren<Flammable>();
				if (Object.op_Implicit((Object)(object)componentInChildren) && componentInChildren.burning && Object.op_Implicit((Object)(object)val7))
				{
					val7.shud.AddPoints(50, "ultrakill.finishedoff", sourceWeapon, val, -1, "", "");
				}
			}
		}
	}
	[BepInPlugin("greycsont.ultrakill.StyleGoRound", "StyleGoRound", "0.0.2")]
	[BepInProcess("ULTRAKILL.exe")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony harmony;

		internal static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			LoadMainModule();
			LoadOptionalModule();
			PatchHarmony();
			Log.LogInfo((object)"Plugin greycsont.ultrakill.StyleGoRound is loaded!");
		}

		private void LoadMainModule()
		{
		}

		private void LoadOptionalModule()
		{
		}

		private void PatchHarmony()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmony = new Harmony("greycsont.ultrakill.StyleGoRound.harmony");
			harmony.PatchAll();
		}
	}
	internal static class PluginInfo
	{
		public const string PLUGIN_GUID = "greycsont.ultrakill.StyleGoRound";

		public const string PLUGIN_NAME = "StyleGoRound";

		public const string PLUGIN_VERSION = "0.0.2";
	}
	public static class RankChecker
	{
		public static bool IsRanked()
		{
			try
			{
				return MonoSingleton<StyleHUD>.Instance.rankIndex > 3;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error checking rank: " + ex.Message));
				return true;
			}
		}
	}
}