Decompiled source of No Enemies v0.0.7

HKSS.NoEnemies.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInExUtils.Attributes;
using BepInExUtils.Extensions;
using BepInExUtils.Interfaces;
using BepInExUtils.Logging;
using BepInExUtils.Proxy;
using GlobalEnums;
using GlobalSettings;
using HKSS.NoEnemies.Behaviour;
using HKSS.NoEnemies.Extensions;
using HKSS.NoEnemies.Proxy;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using TeamCherry.SharedUtils;
using UnityEngine;
using UnityEngine.Audio;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("HKSS.NoEnemies")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1eec5741030a21b63e6179b19fb810889098c7bd")]
[assembly: AssemblyProduct("HKSS.NoEnemies")]
[assembly: AssemblyTitle("HKSS.NoEnemies")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 HKSS.NoEnemies
{
	[BepInUtils("io.github.ykysnk.HKSS.NoEnemies", "No Enemies", "0.0.7")]
	[BepInDependency("io.github.ykysnk.BepinExUtils", "1.0.0")]
	[BepInProcess("Hollow Knight Silksong.exe")]
	[ConfigBind<NoEnemiesMode>("Mode", "Options", NoEnemiesMode.BeGone, "No enemies working modes.")]
	[ConfigBind<bool>("RandomCorpseSplat", "Options", false, "Random corpse splat in the maps.")]
	[BepInPlugin("io.github.ykysnk.HKSS.NoEnemies", "No Enemies", "0.0.7")]
	public class Main : BaseUnityPlugin, IBepInUtils
	{
		private const string SectionOptions = "Options";

		private const string Version = "0.0.7";

		private static Main? _instance;

		private readonly Harmony _harmony = new Harmony("io.github.ykysnk.HKSS.NoEnemies");

		public void Init()
		{
		}

		public Main()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0047: Expected O, but got Unknown
			//IL_005c: 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_0077: Expected O, but got Unknown
			//IL_0077: Expected O, but got Unknown
			_instance = this;
			Configs._Mode = ((BaseUnityPlugin)this).Config.Bind<NoEnemiesMode>(new ConfigDefinition("Options", "Mode"), NoEnemiesMode.BeGone, new ConfigDescription("No enemies working modes.", (AcceptableValueBase)null, Array.Empty<object>()));
			Configs._RandomCorpseSplat = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Options", "RandomCorpseSplat"), false, new ConfigDescription("Random corpse splat in the maps.", (AcceptableValueBase)null, Array.Empty<object>()));
			Configs.Init();
			Utils.Logger.Info((object)"Plugin No Enemies is loaded, version 0.0.7");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			Init();
		}
	}
	public enum NoEnemiesMode
	{
		Off,
		BeGone,
		KillWhenTryAttack
	}
	public static class Utils
	{
		internal const string GameName = "Hollow Knight Silksong.exe";

		internal const string Guid = "io.github.ykysnk.HKSS.NoEnemies";

		internal const string Name = "No Enemies";

		internal const string Version = "0.0.7";

		private static Logger? _logger;

		public static Logger Logger
		{
			get
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				object obj = _logger;
				if (obj == null)
				{
					Logger val = new Logger("No Enemies");
					_logger = val;
					obj = (object)val;
				}
				return (Logger)obj;
			}
		}
	}
	public static class Configs
	{
		public delegate void OnModeValueChangedEvent(NoEnemiesMode oldValue, NoEnemiesMode newValue);

		public delegate void OnRandomCorpseSplatValueChangedEvent(bool oldValue, bool newValue);

		internal static ConfigEntry<NoEnemiesMode>? _Mode;

		internal static ConfigEntry<bool>? _RandomCorpseSplat;

		private static NoEnemiesMode? _oldMode;

		private static bool? _oldRandomCorpseSplat;

		public static NoEnemiesMode Mode
		{
			get
			{
				return _Mode?.Value ?? NoEnemiesMode.Off;
			}
			set
			{
				if (_Mode != null)
				{
					_Mode.Value = value;
				}
			}
		}

		public static bool RandomCorpseSplat
		{
			get
			{
				return _RandomCorpseSplat?.Value ?? false;
			}
			set
			{
				if (_RandomCorpseSplat != null)
				{
					_RandomCorpseSplat.Value = value;
				}
			}
		}

		public static event OnModeValueChangedEvent? OnModeValueChanged;

		public static event OnRandomCorpseSplatValueChangedEvent? OnRandomCorpseSplatValueChanged;

		internal static void Init()
		{
			_oldMode = _Mode?.Value;
			ConfigEntry<NoEnemiesMode>? mode = _Mode;
			if (mode != null)
			{
				mode.SettingChanged += delegate
				{
					Configs.OnModeValueChanged?.Invoke(_oldMode.GetValueOrDefault(), _Mode.Value);
					_oldMode = _Mode.Value;
				};
			}
			_oldRandomCorpseSplat = _RandomCorpseSplat?.Value;
			ConfigEntry<bool>? randomCorpseSplat = _RandomCorpseSplat;
			if (randomCorpseSplat != null)
			{
				randomCorpseSplat.SettingChanged += delegate
				{
					Configs.OnRandomCorpseSplatValueChanged?.Invoke(_oldRandomCorpseSplat.GetValueOrDefault(), _RandomCorpseSplat.Value);
					_oldRandomCorpseSplat = _RandomCorpseSplat.Value;
				};
			}
		}
	}
}
namespace HKSS.NoEnemies.Proxy
{
	[PublicAPI]
	public class HealthManagerItemDropGroupProxy : ClassProxy
	{
		private const string ClassName = "HealthManager+ItemDropGroup";

		public float TotalProbability
		{
			get
			{
				return ObjectExtensions.GetFieldValue<float>(((ClassProxy)this).Native, "TotalProbability");
			}
			set
			{
				ObjectExtensions.SetFieldValue<float>(((ClassProxy)this).Native, "TotalProbability", value);
			}
		}

		public List<HealthManagerItemDropProbabilityProxy> Drops
		{
			get
			{
				IList fieldValue = ObjectExtensions.GetFieldValue<IList>(((ClassProxy)this).Native, "Drops");
				if (fieldValue != null)
				{
					return (from x in fieldValue.OfType<object>()
						select new HealthManagerItemDropProbabilityProxy(x)).ToList();
				}
				return new List<HealthManagerItemDropProbabilityProxy>();
			}
			set
			{
				ObjectExtensions.SetFieldValue<List<object>>(((ClassProxy)this).Native, "Drops", value.Select((HealthManagerItemDropProbabilityProxy x) => ((ClassProxy)x).Native).ToList());
			}
		}

		public HealthManagerItemDropGroupProxy()
			: base("HealthManager+ItemDropGroup")
		{
		}

		public HealthManagerItemDropGroupProxy(object obj)
			: base(obj, "HealthManager+ItemDropGroup")
		{
		}

		public ItemDropProbabilityCopy[] ToDropsCopyArray()
		{
			return Drops.Select((HealthManagerItemDropProbabilityProxy x) => new ItemDropProbabilityCopy
			{
				item = x.item,
				Amount = x.Amount,
				CustomPickupPrefab = x.CustomPickupPrefab,
				LimitActiveInScene = x.LimitActiveInScene
			}).ToArray();
		}
	}
	[PublicAPI]
	public class HealthManagerItemDropProbabilityProxy : ClassProxy
	{
		private const string ClassName = "HealthManager+ItemDropProbability";

		public SavedItem item
		{
			get
			{
				return ObjectExtensions.GetFieldValue<SavedItem>(((ClassProxy)this).Native, "item");
			}
			set
			{
				ObjectExtensions.SetFieldValue<SavedItem>(((ClassProxy)this).Native, "item", value);
			}
		}

		public MinMaxInt Amount
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return ObjectExtensions.GetFieldValue<MinMaxInt>(((ClassProxy)this).Native, "amount");
			}
			set
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				ObjectExtensions.SetFieldValue<MinMaxInt>(((ClassProxy)this).Native, "amount", value);
			}
		}

		public CollectableItemPickup CustomPickupPrefab
		{
			get
			{
				return ObjectExtensions.GetFieldValue<CollectableItemPickup>(((ClassProxy)this).Native, "customPickupPrefab");
			}
			set
			{
				ObjectExtensions.SetFieldValue<CollectableItemPickup>(((ClassProxy)this).Native, "customPickupPrefab", value);
			}
		}

		public int LimitActiveInScene
		{
			get
			{
				return ObjectExtensions.GetFieldValue<int>(((ClassProxy)this).Native, "limitActiveInScene");
			}
			set
			{
				ObjectExtensions.SetFieldValue<int>(((ClassProxy)this).Native, "limitActiveInScene", value);
			}
		}

		public HealthManagerItemDropProbabilityProxy()
			: base("HealthManager+ItemDropProbability")
		{
		}

		public HealthManagerItemDropProbabilityProxy(object obj)
			: base(obj, "HealthManager+ItemDropProbability")
		{
		}
	}
	[Serializable]
	public class ItemDropProbabilityCopy : ProbabilityBase<SavedItem>
	{
		[SerializeField]
		internal SavedItem? item;

		public MinMaxInt Amount = new MinMaxInt(1, 1);

		public CollectableItemPickup? CustomPickupPrefab;

		public int LimitActiveInScene;

		public override SavedItem Item => item;
	}
}
namespace HKSS.NoEnemies.Patches
{
	[HarmonyPatch(typeof(HealthManager))]
	internal class HealthManagerPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		private static void Awake(HealthManager __instance)
		{
			Utils.Logger.Debug((object)$"__instance {__instance} {((Object)((Component)__instance).gameObject).name}");
			NoEnemiesController noEnemiesController = default(NoEnemiesController);
			NoEnemiesController noEnemiesController2 = ((!((Component)__instance).gameObject.TryGetComponent<NoEnemiesController>(ref noEnemiesController)) ? ((Component)__instance).gameObject.AddComponent<NoEnemiesController>() : noEnemiesController);
			Utils.Logger.Debug((object)$"controller {noEnemiesController2}");
			noEnemiesController2.HealthManager = __instance;
		}
	}
	[HarmonyPatch(typeof(HeroBox))]
	internal class HeroBoxPatches
	{
		[HarmonyPatch("CheckForDamage")]
		private static bool CheckForDamage(HeroBox __instance, GameObject otherGameObject)
		{
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)otherGameObject))
			{
				return true;
			}
			Utils.Logger.Debug((object)("TakeDamage by " + GameObjectExtensions.FullName(otherGameObject.gameObject)));
			if (Configs.Mode != NoEnemiesMode.KillWhenTryAttack)
			{
				return true;
			}
			GameObject val = (Object.op_Implicit((Object)(object)otherGameObject.transform.parent) ? ((Component)otherGameObject.transform.parent).gameObject : null);
			GameObject val2 = (Object.op_Implicit((Object)(object)otherGameObject.transform.root) ? ((Component)otherGameObject.transform.root).gameObject : null);
			HealthManager val3 = default(HealthManager);
			HealthManager val4 = (otherGameObject.TryGetComponent<HealthManager>(ref val3) ? val3 : ((val != null && val.TryGetComponent<HealthManager>(ref val3)) ? val3 : ((val2 != null && val2.TryGetComponent<HealthManager>(ref val3)) ? val3 : null)));
			if (!Object.op_Implicit((Object)(object)val4))
			{
				return true;
			}
			Utils.Logger.Debug((object)(GameObjectExtensions.FullName(otherGameObject.gameObject) + " Trying to attack"));
			val4.DieDropFling(NoEnemiesController.HitInstance.ToolDamageFlags, bool1: true);
			val4.BeGone(null, NoEnemiesController.HitInstance.AttackType, NoEnemiesController.HitInstance.NailElement, NoEnemiesController.HitInstance.Source, NoEnemiesController.HitInstance.IgnoreInvulnerable, 0f);
			return false;
		}
	}
	[HarmonyPatch(typeof(HeroController))]
	internal static class HeroControllerPatches
	{
		[HarmonyPatch("TakeDamage")]
		[HarmonyPrefix]
		private static bool TakeDamage(HeroController __instance, GameObject go, CollisionSide damageSide, int damageAmount, HazardType hazardType, DamagePropertyFlags damagePropertyFlags)
		{
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)go))
			{
				return true;
			}
			Utils.Logger.Debug((object)("TakeDamage by " + GameObjectExtensions.FullName(go.gameObject)));
			if (Configs.Mode != NoEnemiesMode.KillWhenTryAttack)
			{
				return true;
			}
			GameObject val = (Object.op_Implicit((Object)(object)go.transform.parent) ? ((Component)go.transform.parent).gameObject : null);
			GameObject val2 = (Object.op_Implicit((Object)(object)go.transform.root) ? ((Component)go.transform.root).gameObject : null);
			HealthManager val3 = default(HealthManager);
			HealthManager val4 = (go.TryGetComponent<HealthManager>(ref val3) ? val3 : ((val != null && val.TryGetComponent<HealthManager>(ref val3)) ? val3 : ((val2 != null && val2.TryGetComponent<HealthManager>(ref val3)) ? val3 : null)));
			if (!Object.op_Implicit((Object)(object)val4))
			{
				return true;
			}
			Utils.Logger.Debug((object)(GameObjectExtensions.FullName(go.gameObject) + " Trying to attack"));
			val4.DieDropFling(NoEnemiesController.HitInstance.ToolDamageFlags, bool1: true);
			val4.BeGone(null, NoEnemiesController.HitInstance.AttackType, NoEnemiesController.HitInstance.NailElement, NoEnemiesController.HitInstance.Source, NoEnemiesController.HitInstance.IgnoreInvulnerable, 0f);
			__instance.SetState((ActorStates)1);
			__instance.AcceptInput();
			return false;
		}
	}
}
namespace HKSS.NoEnemies.Extensions
{
	[AccessExtensions]
	[AccessInstance<ActiveCorpse>]
	[AccessField<tk2dSprite>("sprite")]
	[PublicAPI]
	public static class ActiveCorpseExtensions
	{
		public sealed class <>E__0
		{
			public tk2dSprite sprite
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}
		}

		[SpecialName]
		public static tk2dSprite get_sprite(ActiveCorpse instance)
		{
			return ObjectExtensions.GetFieldValue<tk2dSprite>((object)instance, "sprite");
		}

		[SpecialName]
		public static void set_sprite(ActiveCorpse instance, tk2dSprite value)
		{
			ObjectExtensions.SetFieldValue<tk2dSprite>((object)instance, "sprite", value);
		}
	}
	[AccessExtensions]
	[AccessInstance<EnemyDeathEffects>]
	[AccessField<bool>("didFire")]
	[AccessField<bool>("isCorpseRecyclable")]
	[AccessField<string>("awardAchievement")]
	[AccessField<AudioMixerSnapshot>("audioSnapshotOnDeath")]
	[AccessField<string>("sendEventRegister")]
	[AccessField<bool>("recycle")]
	[AccessMethod("ShakeCameraIfVisible", new Type[] { })]
	[AccessMethod("EmitEffects", new Type[] { typeof(GameObject) })]
	public static class EnemyDeathEffectsExtensions
	{
		public sealed class <>E__0
		{
			public bool didFire
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public bool isCorpseRecyclable
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public string awardAchievement
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public AudioMixerSnapshot audioSnapshotOnDeath
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public string sendEventRegister
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public bool recycle
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public void ShakeCameraIfVisible()
			{
				throw null;
			}

			public void EmitEffects(GameObject gameObject1)
			{
				throw null;
			}
		}

		public static void ReceiveBeGoneEvent(this EnemyDeathEffects effects, float? attackDirection, AttackTypes attackType, NailElements nailElement, GameObject damageSource, float corpseFlingMultiplier, bool resetDeathEvent, Action<Transform>? onCorpseBegin, out bool didCallCorpseBegin, out GameObject? corpseObj)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Invalid comparison between Unknown and I4
			//IL_009d: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Invalid comparison between Unknown and I4
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			didCallCorpseBegin = false;
			corpseObj = null;
			if (effects != null && get_didFire(effects) && !get_isCorpseRecyclable(effects))
			{
				return;
			}
			set_didFire(effects, value: true);
			effects.RecordKillForJournal();
			if ((double)corpseFlingMultiplier > 1.350000023841858)
			{
				corpseFlingMultiplier = 1.35f;
			}
			int num;
			if ((int)attackType != 5)
			{
				if ((int)attackType == 8)
				{
					if (Configs.Mode != NoEnemiesMode.BeGone)
					{
						effects.ShakeCameraIfVisible();
					}
					if (Object.op_Implicit((Object)(object)Corpse.EnemyLavaDeath))
					{
						Extensions.SetPosition2D(ObjectPoolExtensions.Spawn(Corpse.EnemyLavaDeath).transform, Vector2.op_Implicit(((Component)effects).transform.TransformPoint(effects.effectOrigin)));
					}
					goto IL_00e4;
				}
				num = (((int)attackType == 3) ? 1 : 0);
			}
			else
			{
				num = 1;
			}
			corpseObj = effects.EmitCorpse(attackDirection, corpseFlingMultiplier, attackType, nailElement, damageSource, onCorpseBegin, out didCallCorpseBegin);
			Utils.Logger.Debug((object)$"corpseObj is spawn: {MonoBehaviourExtensions.FullName((MonoBehaviour)(object)effects)} {corpseObj} {GameObjectExtensions.FullName(corpseObj)}");
			if (num == 0 && Configs.Mode != NoEnemiesMode.BeGone)
			{
				effects.EmitEffects(corpseObj);
			}
			goto IL_00e4;
			IL_00e4:
			GameManager instance = GameManager.instance;
			if (!string.IsNullOrEmpty(effects.setPlayerDataBool))
			{
				instance.playerData.SetBool(effects.setPlayerDataBool, true);
			}
			if (!string.IsNullOrWhiteSpace(get_awardAchievement(effects)))
			{
				instance.AwardAchievement(get_awardAchievement(effects));
			}
			if (!effects.doNotSetHasKilled)
			{
				instance.playerData.SetBool("hasKilled", true);
			}
			if (Object.op_Implicit((Object)(object)get_audioSnapshotOnDeath(effects)))
			{
				get_audioSnapshotOnDeath(effects).TransitionTo(2f);
			}
			if (!string.IsNullOrEmpty(get_sendEventRegister(effects)))
			{
				EventRegister.SendEvent(get_sendEventRegister(effects), (GameObject)null);
			}
			if (!resetDeathEvent)
			{
				PersistentBoolItem component = ((Component)effects).GetComponent<PersistentBoolItem>();
				if (Object.op_Implicit((Object)(object)component))
				{
					((PersistentItem<bool>)(object)component).SaveState();
				}
				if (get_recycle(effects))
				{
					PlayMakerFSM val = FSMUtility.LocateFSM(((Component)effects).gameObject, "health_manager_enemy");
					if (Object.op_Implicit((Object)(object)val))
					{
						val.FsmVariables.GetFsmBool("Activated").Value = false;
					}
					HealthManager component2 = ((Component)effects).GetComponent<HealthManager>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						component2.SetIsDead(false);
					}
					set_didFire(effects, value: false);
					ObjectPoolExtensions.Recycle(((Component)effects).gameObject);
				}
				else
				{
					Object.Destroy((Object)(object)((Component)effects).gameObject);
				}
			}
			else
			{
				FSMUtility.SendEventToGameObject(((Component)effects).gameObject, "CENTIPEDE DEATH", false);
				set_didFire(effects, value: false);
			}
		}

		public static GameObject EmitCorpse(this EnemyDeathEffects instance, float? attackDirection, float flingMultiplier, AttackTypes attackType, NailElements nailElement, GameObject damageSource, Action<Transform>? onCorpseBegin, out bool didCallCorpseBegin)
		{
			//IL_001a: 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)
			object[] array = new object[7] { attackDirection, flingMultiplier, attackType, nailElement, damageSource, onCorpseBegin, null };
			MethodInfo methodInfo = AccessTools.Method(((object)instance).GetType(), "EmitCorpse", (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				throw new MethodAccessException("EmitCorpse method not found.");
			}
			object? obj = methodInfo.Invoke(instance, array);
			object valueOrDefault = ListExtensions.GetValueOrDefault<object>(array, 6);
			didCallCorpseBegin = valueOrDefault is bool && (bool)valueOrDefault;
			return (GameObject)(((obj is GameObject) ? obj : null) ?? throw new MethodAccessException("EmitCorpse method return value is not GameObject."));
		}

		[SpecialName]
		public static bool get_didFire(EnemyDeathEffects instance)
		{
			return ObjectExtensions.GetFieldValue<bool>((object)instance, "didFire");
		}

		[SpecialName]
		public static void set_didFire(EnemyDeathEffects instance, bool value)
		{
			ObjectExtensions.SetFieldValue<bool>((object)instance, "didFire", value);
		}

		[SpecialName]
		public static bool get_isCorpseRecyclable(EnemyDeathEffects instance)
		{
			return ObjectExtensions.GetFieldValue<bool>((object)instance, "isCorpseRecyclable");
		}

		[SpecialName]
		public static void set_isCorpseRecyclable(EnemyDeathEffects instance, bool value)
		{
			ObjectExtensions.SetFieldValue<bool>((object)instance, "isCorpseRecyclable", value);
		}

		[SpecialName]
		public static string get_awardAchievement(EnemyDeathEffects instance)
		{
			return ObjectExtensions.GetFieldValue<string>((object)instance, "awardAchievement");
		}

		[SpecialName]
		public static void set_awardAchievement(EnemyDeathEffects instance, string value)
		{
			ObjectExtensions.SetFieldValue<string>((object)instance, "awardAchievement", value);
		}

		[SpecialName]
		public static AudioMixerSnapshot get_audioSnapshotOnDeath(EnemyDeathEffects instance)
		{
			return ObjectExtensions.GetFieldValue<AudioMixerSnapshot>((object)instance, "audioSnapshotOnDeath");
		}

		[SpecialName]
		public static void set_audioSnapshotOnDeath(EnemyDeathEffects instance, AudioMixerSnapshot value)
		{
			ObjectExtensions.SetFieldValue<AudioMixerSnapshot>((object)instance, "audioSnapshotOnDeath", value);
		}

		[SpecialName]
		public static string get_sendEventRegister(EnemyDeathEffects instance)
		{
			return ObjectExtensions.GetFieldValue<string>((object)instance, "sendEventRegister");
		}

		[SpecialName]
		public static void set_sendEventRegister(EnemyDeathEffects instance, string value)
		{
			ObjectExtensions.SetFieldValue<string>((object)instance, "sendEventRegister", value);
		}

		[SpecialName]
		public static bool get_recycle(EnemyDeathEffects instance)
		{
			return ObjectExtensions.GetFieldValue<bool>((object)instance, "recycle");
		}

		[SpecialName]
		public static void set_recycle(EnemyDeathEffects instance, bool value)
		{
			ObjectExtensions.SetFieldValue<bool>((object)instance, "recycle", value);
		}

		[SpecialName]
		public static void ShakeCameraIfVisible(this EnemyDeathEffects instance)
		{
			ObjectExtensions.MethodInvoke((object)instance, "ShakeCameraIfVisible", Array.Empty<object>());
		}

		[SpecialName]
		public static void EmitEffects(this EnemyDeathEffects instance, GameObject gameObject1)
		{
			ObjectExtensions.MethodInvoke((object)instance, "EmitEffects", new object[1] { gameObject1 });
		}
	}
	[AccessExtensions]
	[AccessInstance<HealthManager>]
	[AccessField<bool>("hasBlackThreadState")]
	[AccessField<BlackThreadState>("blackThreadState")]
	[AccessField<GameObject>("battleScene")]
	[AccessField<bool>("bigEnemyDeath")]
	[AccessField<bool>("preventDeathAfterHero")]
	[AccessField<int>("shellShardDrops")]
	[AccessField<int>("smallGeoDrops")]
	[AccessField<int>("mediumGeoDrops")]
	[AccessField<int>("largeGeoDrops")]
	[AccessField<int>("largeSmoothGeoDrops")]
	[AccessField<float[]>("_shellShardMultiplierArray")]
	[AccessField<bool>("megaFlingGeo")]
	[AccessField<QueuedDropItem>("queuedDropItem")]
	[AccessField<GameObject>("zeroHPEventOverride")]
	[AccessField<DamageHero>("damageHero")]
	[AccessField<bool>("notifiedBattleScene")]
	[AccessField<AudioMixerSnapshot>("deathAudioSnapshot")]
	[AccessField<GameObject>("sendKilledTo")]
	[AccessField<GameObject>("corpseSplatPrefab")]
	[AccessField<Vector3>("effectOrigin")]
	[AccessField<EnemyDeathEffects>("enemyDeathEffects")]
	[AccessField<EventRelayResponder>("corpseEventResponder")]
	[AccessMethod("Invincible", new Type[] { typeof(HitInstance) })]
	[AccessMethod("TakeDamage", new Type[] { typeof(HitInstance) })]
	[AccessMethod("DieDropFling", new Type[]
	{
		typeof(ToolDamageFlags),
		typeof(bool)
	})]
	[AccessMethod("SpawnCurrency", new Type[]
	{
		typeof(Transform),
		typeof(float),
		typeof(float),
		typeof(float),
		typeof(float),
		typeof(int),
		typeof(int),
		typeof(int),
		typeof(int),
		typeof(bool),
		typeof(int),
		typeof(bool)
	})]
	[AccessMethod("SpawnQueuedItemDrop", new Type[]
	{
		typeof(QueuedDropItem),
		typeof(Transform)
	})]
	[AccessMethod("SpawnItemDrop", new Type[]
	{
		typeof(SavedItem),
		typeof(int),
		typeof(CollectableItemPickup),
		typeof(Transform),
		typeof(int)
	})]
	[AccessMethod("NonFatalHit", new Type[] { typeof(bool) })]
	[PublicAPI]
	public static class HealthManagerExtensions
	{
		public sealed class <>E__0
		{
			[PublicAPI]
			public List<HealthManagerItemDropGroupProxy> itemDropGroups
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}
		}

		public sealed class <>E__1
		{
			public bool hasBlackThreadState
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public BlackThreadState blackThreadState
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public GameObject battleScene
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public bool bigEnemyDeath
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public bool preventDeathAfterHero
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public int shellShardDrops
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public int smallGeoDrops
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public int mediumGeoDrops
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public int largeGeoDrops
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public int largeSmoothGeoDrops
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public float[] _shellShardMultiplierArray
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public bool megaFlingGeo
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public QueuedDropItem queuedDropItem
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public GameObject zeroHPEventOverride
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public DamageHero damageHero
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public bool notifiedBattleScene
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public AudioMixerSnapshot deathAudioSnapshot
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public GameObject sendKilledTo
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public GameObject corpseSplatPrefab
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public Vector3 effectOrigin
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public EnemyDeathEffects enemyDeathEffects
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public EventRelayResponder corpseEventResponder
			{
				get
				{
					throw null;
				}
				set
				{
					throw null;
				}
			}

			public void Invincible(HitInstance hitInstance1)
			{
				throw null;
			}

			public void TakeDamage(HitInstance hitInstance1)
			{
				throw null;
			}

			public void DieDropFling(ToolDamageFlags toolDamageFlags1, bool bool1)
			{
				throw null;
			}

			public void SpawnCurrency(Transform transform1, float float1, float float2, float float3, float float4, int int1, int int2, int int3, int int4, bool bool1, int int5, bool bool2)
			{
				throw null;
			}

			public void SpawnQueuedItemDrop(QueuedDropItem healthManager_QueuedDropItem1, Transform transform1)
			{
				throw null;
			}

			public void SpawnItemDrop(SavedItem savedItem1, int int1, CollectableItemPickup collectableItemPickup1, Transform transform1, int int2)
			{
				throw null;
			}

			public void NonFatalHit(bool bool1)
			{
				throw null;
			}
		}

		public static void BeGone(this HealthManager instance, float? attackDirection, AttackTypes attackType, NailElements nailElement, GameObject damageSource, bool ignoreEvasion = false, float corpseFlingMultiplier = 1f, bool overrideSpecialDeath = false, bool disallowDropFling = false)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Invalid comparison between Unknown and I4
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Invalid comparison between Unknown and I4
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Invalid comparison between Unknown and I4
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: 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_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: 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_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			HealthManager instance2 = instance;
			Utils.Logger.Debug((object)("BeGone is called: " + GameObjectExtensions.FullName(((Component)instance2).gameObject)));
			instance2.hp = -1;
			if (instance2.isDead)
			{
				return;
			}
			instance2.CancelAllLagHits();
			float minCorpseFlingMagnitudeMult = Corpse.MinCorpseFlingMagnitudeMult;
			if (corpseFlingMultiplier < minCorpseFlingMagnitudeMult && Math.Abs(corpseFlingMultiplier) > Mathf.Epsilon)
			{
				corpseFlingMultiplier = minCorpseFlingMagnitudeMult;
			}
			Action<Transform> action = null;
			if (!disallowDropFling && (int)attackType != 5 && (int)GameManager.instance.GetCurrentMapZoneEnum() != 33)
			{
				int smallGeoExtra = 0;
				int mediumGeoExtra = 0;
				int largeGeoExtra = 0;
				int largeSmoothGeoExtra = 0;
				int shellShardExtra = 0;
				int shellShardBase = get_shellShardDrops(instance2);
				bool thiefCharmEquipped = ((ToolBase)Gameplay.ThiefCharmTool).IsEquipped;
				if (thiefCharmEquipped)
				{
					smallGeoExtra = Mathf.CeilToInt((float)get_smallGeoDrops(instance2) * Gameplay.ThiefCharmGeoSmallIncrease);
					mediumGeoExtra = Mathf.CeilToInt((float)get_mediumGeoDrops(instance2) * Gameplay.ThiefCharmGeoMedIncrease);
					largeGeoExtra = Mathf.CeilToInt((float)get_largeGeoDrops(instance2) * Gameplay.ThiefCharmGeoLargeIncrease);
					largeSmoothGeoExtra = Mathf.CeilToInt((float)get_largeSmoothGeoDrops(instance2) * Gameplay.ThiefCharmGeoLargeIncrease);
				}
				float num = get__shellShardMultiplierArray(instance2)[Random.Range(0, get__shellShardMultiplierArray(instance2).Length)];
				int num2 = Mathf.CeilToInt((float)shellShardBase * num - (float)shellShardBase);
				if (num2 > 8)
				{
					num2 = 8;
				}
				shellShardBase += num2;
				ToolItem boneNecklaceTool = Gameplay.BoneNecklaceTool;
				if (Object.op_Implicit((Object)(object)boneNecklaceTool) && ((ToolBase)boneNecklaceTool).IsEquipped)
				{
					shellShardExtra = Mathf.CeilToInt((float)shellShardBase * Gameplay.BoneNecklaceShellshardIncrease);
				}
				int dropFlingAngleMin = (get_megaFlingGeo(instance2) ? 65 : 80);
				int dropFlingAngleMax = (get_megaFlingGeo(instance2) ? 115 : 100);
				int dropFlingSpeedMin = (get_megaFlingGeo(instance2) ? 30 : 15);
				int dropFlingSpeedMax = (get_megaFlingGeo(instance2) ? 45 : 30);
				Transform sourceTransform = ((Component)instance2).transform;
				QueuedDropItem queuedItem = get_queuedDropItem(instance2);
				QueuedDropItem val = get_queuedDropItem(instance2);
				((QueuedDropItem)(ref val)).Reset();
				action = delegate(Transform spawnPoint)
				{
					//IL_014b: Unknown result type (might be due to invalid IL or missing references)
					Transform spawnPoint2 = spawnPoint;
					Utils.Logger.Debug((object)$"onCorpseBegin is called: {GameObjectExtensions.FullName(((Component)instance2).gameObject)} {TransformExtensions.FullName(spawnPoint2)} {spawnPoint2}");
					instance2.SpawnCurrency(spawnPoint2, dropFlingSpeedMin, dropFlingSpeedMax, dropFlingAngleMin, dropFlingAngleMax, get_smallGeoDrops(instance2), get_mediumGeoDrops(instance2), get_largeGeoDrops(instance2), get_largeSmoothGeoDrops(instance2), bool1: false, shellShardBase, bool2: false);
					instance2.SpawnCurrency(spawnPoint2, dropFlingSpeedMin, dropFlingSpeedMax, dropFlingAngleMin, dropFlingAngleMax, 0, 0, 0, 0, bool1: false, shellShardExtra, bool2: true);
					if (smallGeoExtra > 0 || mediumGeoExtra > 0 || largeGeoExtra > 0 || largeSmoothGeoExtra > 0)
					{
						if ((Object)(object)spawnPoint2 == (Object)(object)sourceTransform)
						{
							SpawnExtraGeo();
						}
						else
						{
							Extensions.ExecuteDelayed(((Component)spawnPoint2).GetComponent<MonoBehaviour>(), 0.2f, (Action)SpawnExtraGeo);
						}
					}
					instance2.SpawnQueuedItemDrop(queuedItem, spawnPoint2);
					Utils.Logger.Debug((object)$"instance.itemDropGroups: {get_itemDropGroups(instance2)} {get_itemDropGroups(instance2).Count}");
					foreach (ItemDropProbabilityCopy item in from itemDropGroup in get_itemDropGroups(instance2)
						where itemDropGroup.Drops.Count > 0 && (double)itemDropGroup.TotalProbability >= 1.0
						select (ItemDropProbabilityCopy)(object)Probability.GetRandomItemRootByProbability<ItemDropProbabilityCopy, SavedItem>(itemDropGroup.ToDropsCopyArray(), (float[])null))
					{
						instance2.SpawnItemDrop(((ProbabilityBase<SavedItem>)(object)item).Item, ((MinMaxInt)(ref item.Amount)).GetRandomValue(true), item.CustomPickupPrefab, spawnPoint2, item.LimitActiveInScene);
					}
					void SpawnExtraGeo()
					{
						//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_001b: Unknown result type (might be due to invalid IL or missing references)
						if (thiefCharmEquipped)
						{
							AudioEvent thiefCharmEnemyDeathAudio = Gameplay.ThiefCharmEnemyDeathAudio;
							((AudioEvent)(ref thiefCharmEnemyDeathAudio)).SpawnAndPlayOneShot(spawnPoint2.position, (Action)null);
						}
						instance2.SpawnCurrency(spawnPoint2, dropFlingSpeedMin, dropFlingSpeedMax, dropFlingAngleMin, dropFlingAngleMax, smallGeoExtra, mediumGeoExtra, largeGeoExtra, largeSmoothGeoExtra, bool1: true, 0, bool2: false);
					}
				};
			}
			if (!overrideSpecialDeath)
			{
				GameObject val2 = (Object.op_Implicit((Object)(object)get_zeroHPEventOverride(instance2)) ? get_zeroHPEventOverride(instance2) : ((Component)instance2).gameObject);
				FSMUtility.SendEventToGameObject(val2, "ZERO HP", false);
				if (Object.op_Implicit((Object)(object)get_blackThreadState(instance2)))
				{
					get_blackThreadState(instance2).CancelAttack();
				}
				if ((int)attackType == 8)
				{
					FSMUtility.SendEventToGameObject(val2, "LAVA DEATH", false);
				}
				Utils.Logger.Debug((object)$"the obj death: {val2} {GameObjectExtensions.FullName(val2)} instance.hasSpecialDeath {instance2.hasSpecialDeath}");
				if (instance2.hasSpecialDeath)
				{
					instance2.NonFatalHit(ignoreEvasion);
					action?.Invoke(((Component)instance2).transform);
					return;
				}
			}
			instance2.isDead = true;
			if (Object.op_Implicit((Object)(object)get_damageHero(instance2)))
			{
				get_damageHero(instance2).damageDealt = 0;
			}
			if (Object.op_Implicit((Object)(object)get_battleScene(instance2)) && !get_notifiedBattleScene(instance2))
			{
				BattleScene component = get_battleScene(instance2).GetComponent<BattleScene>();
				if (Object.op_Implicit((Object)(object)component))
				{
					if (!get_bigEnemyDeath(instance2))
					{
						component.DecrementEnemy();
					}
					else
					{
						component.DecrementBigEnemy();
					}
				}
			}
			if (Object.op_Implicit((Object)(object)get_deathAudioSnapshot(instance2)))
			{
				get_deathAudioSnapshot(instance2).TransitionTo(6f);
			}
			if (Object.op_Implicit((Object)(object)get_sendKilledTo(instance2)))
			{
				FSMUtility.SendEventToGameObject(get_sendKilledTo(instance2), "KILLED", false);
			}
			instance2.SendDeathEvent();
			Utils.Logger.Debug((object)$"the obj: {((Component)instance2).gameObject} {GameObjectExtensions.FullName(((Component)instance2).gameObject)}");
			if (Configs.RandomCorpseSplat)
			{
				ObjectPoolExtensions.Spawn(get_corpseSplatPrefab(instance2), ((Component)instance2).transform.position + get_effectOrigin(instance2), Quaternion.identity);
			}
			if ((int)attackType == 4)
			{
				if (Configs.Mode != NoEnemiesMode.BeGone)
				{
					GameCameras.instance.cameraShakeFSM.SendEvent("AverageShake");
					ObjectPoolExtensions.Spawn(get_corpseSplatPrefab(instance2), ((Component)instance2).transform.position + get_effectOrigin(instance2), Quaternion.identity);
					if (Object.op_Implicit((Object)(object)get_enemyDeathEffects(instance2)))
					{
						get_enemyDeathEffects(instance2).EmitSound();
					}
				}
				((Component)instance2).gameObject.SetActive(false);
				return;
			}
			bool didCallCorpseBegin;
			GameObject corpseObj;
			if (Object.op_Implicit((Object)(object)get_enemyDeathEffects(instance2)))
			{
				get_enemyDeathEffects(instance2).SkipKillFreeze = true;
				get_enemyDeathEffects(instance2).ReceiveBeGoneEvent(attackDirection, attackType, nailElement, damageSource, corpseFlingMultiplier, instance2.deathReset, action, out didCallCorpseBegin, out corpseObj);
			}
			else
			{
				didCallCorpseBegin = false;
				corpseObj = null;
			}
			Utils.Logger.Debug((object)$"didCallCorpseBegin: {didCallCorpseBegin} {corpseObj} {((corpseObj != null) ? GameObjectExtensions.FullName(corpseObj) : null)} {action}");
			ActiveCorpse val3 = default(ActiveCorpse);
			if (Configs.Mode == NoEnemiesMode.BeGone && Object.op_Implicit((Object)(object)corpseObj) && corpseObj.TryGetComponent<ActiveCorpse>(ref val3))
			{
				Utils.Logger.Debug((object)$"corpseObj change color: {corpseObj} {GameObjectExtensions.FullName(corpseObj)}");
				Color color = ((tk2dBaseSprite)ActiveCorpseExtensions.get_sprite(val3)).color;
				color.a = 0f;
				((tk2dBaseSprite)ActiveCorpseExtensions.get_sprite(val3)).color = color;
				val3.SetBlockAudio(true);
			}
			if (!didCallCorpseBegin)
			{
				action?.Invoke(Object.op_Implicit((Object)(object)corpseObj) ? corpseObj.transform : ((Component)instance2).transform);
			}
			if (Object.op_Implicit((Object)(object)corpseObj) && Object.op_Implicit((Object)(object)get_corpseEventResponder(instance2)))
			{
				corpseObj.GetComponent<EventRelay>().TemporaryEvent += get_corpseEventResponder(instance2).ReceiveEvent;
				Utils.Logger.Debug((object)$"corpseObj: {corpseObj} {GameObjectExtensions.FullName(corpseObj)}");
			}
		}

		[SpecialName]
		public static List<HealthManagerItemDropGroupProxy> get_itemDropGroups(HealthManager instance)
		{
			IList fieldValue = ObjectExtensions.GetFieldValue<IList>((object)instance, "itemDropGroups");
			if (fieldValue != null)
			{
				return (from x in fieldValue.OfType<object>()
					select new HealthManagerItemDropGroupProxy(x)).ToList();
			}
			return new List<HealthManagerItemDropGroupProxy>();
		}

		[SpecialName]
		public static void set_itemDropGroups(HealthManager instance, List<HealthManagerItemDropGroupProxy> value)
		{
			ObjectExtensions.SetFieldValue<List<object>>((object)instance, "itemDropGroups", value.Select((HealthManagerItemDropGroupProxy x) => ((ClassProxy)x).Native).ToList());
		}

		[SpecialName]
		public static bool get_hasBlackThreadState(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<bool>((object)instance, "hasBlackThreadState");
		}

		[SpecialName]
		public static void set_hasBlackThreadState(HealthManager instance, bool value)
		{
			ObjectExtensions.SetFieldValue<bool>((object)instance, "hasBlackThreadState", value);
		}

		[SpecialName]
		public static BlackThreadState get_blackThreadState(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<BlackThreadState>((object)instance, "blackThreadState");
		}

		[SpecialName]
		public static void set_blackThreadState(HealthManager instance, BlackThreadState value)
		{
			ObjectExtensions.SetFieldValue<BlackThreadState>((object)instance, "blackThreadState", value);
		}

		[SpecialName]
		public static GameObject get_battleScene(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<GameObject>((object)instance, "battleScene");
		}

		[SpecialName]
		public static void set_battleScene(HealthManager instance, GameObject value)
		{
			ObjectExtensions.SetFieldValue<GameObject>((object)instance, "battleScene", value);
		}

		[SpecialName]
		public static bool get_bigEnemyDeath(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<bool>((object)instance, "bigEnemyDeath");
		}

		[SpecialName]
		public static void set_bigEnemyDeath(HealthManager instance, bool value)
		{
			ObjectExtensions.SetFieldValue<bool>((object)instance, "bigEnemyDeath", value);
		}

		[SpecialName]
		public static bool get_preventDeathAfterHero(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<bool>((object)instance, "preventDeathAfterHero");
		}

		[SpecialName]
		public static void set_preventDeathAfterHero(HealthManager instance, bool value)
		{
			ObjectExtensions.SetFieldValue<bool>((object)instance, "preventDeathAfterHero", value);
		}

		[SpecialName]
		public static int get_shellShardDrops(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<int>((object)instance, "shellShardDrops");
		}

		[SpecialName]
		public static void set_shellShardDrops(HealthManager instance, int value)
		{
			ObjectExtensions.SetFieldValue<int>((object)instance, "shellShardDrops", value);
		}

		[SpecialName]
		public static int get_smallGeoDrops(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<int>((object)instance, "smallGeoDrops");
		}

		[SpecialName]
		public static void set_smallGeoDrops(HealthManager instance, int value)
		{
			ObjectExtensions.SetFieldValue<int>((object)instance, "smallGeoDrops", value);
		}

		[SpecialName]
		public static int get_mediumGeoDrops(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<int>((object)instance, "mediumGeoDrops");
		}

		[SpecialName]
		public static void set_mediumGeoDrops(HealthManager instance, int value)
		{
			ObjectExtensions.SetFieldValue<int>((object)instance, "mediumGeoDrops", value);
		}

		[SpecialName]
		public static int get_largeGeoDrops(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<int>((object)instance, "largeGeoDrops");
		}

		[SpecialName]
		public static void set_largeGeoDrops(HealthManager instance, int value)
		{
			ObjectExtensions.SetFieldValue<int>((object)instance, "largeGeoDrops", value);
		}

		[SpecialName]
		public static int get_largeSmoothGeoDrops(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<int>((object)instance, "largeSmoothGeoDrops");
		}

		[SpecialName]
		public static void set_largeSmoothGeoDrops(HealthManager instance, int value)
		{
			ObjectExtensions.SetFieldValue<int>((object)instance, "largeSmoothGeoDrops", value);
		}

		[SpecialName]
		public static float[] get__shellShardMultiplierArray(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<float[]>((object)instance, "_shellShardMultiplierArray");
		}

		[SpecialName]
		public static void set__shellShardMultiplierArray(HealthManager instance, float[] value)
		{
			ObjectExtensions.SetFieldValue<float[]>((object)instance, "_shellShardMultiplierArray", value);
		}

		[SpecialName]
		public static bool get_megaFlingGeo(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<bool>((object)instance, "megaFlingGeo");
		}

		[SpecialName]
		public static void set_megaFlingGeo(HealthManager instance, bool value)
		{
			ObjectExtensions.SetFieldValue<bool>((object)instance, "megaFlingGeo", value);
		}

		[SpecialName]
		public static QueuedDropItem get_queuedDropItem(HealthManager instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ObjectExtensions.GetFieldValue<QueuedDropItem>((object)instance, "queuedDropItem");
		}

		[SpecialName]
		public static void set_queuedDropItem(HealthManager instance, QueuedDropItem value)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			ObjectExtensions.SetFieldValue<QueuedDropItem>((object)instance, "queuedDropItem", value);
		}

		[SpecialName]
		public static GameObject get_zeroHPEventOverride(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<GameObject>((object)instance, "zeroHPEventOverride");
		}

		[SpecialName]
		public static void set_zeroHPEventOverride(HealthManager instance, GameObject value)
		{
			ObjectExtensions.SetFieldValue<GameObject>((object)instance, "zeroHPEventOverride", value);
		}

		[SpecialName]
		public static DamageHero get_damageHero(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<DamageHero>((object)instance, "damageHero");
		}

		[SpecialName]
		public static void set_damageHero(HealthManager instance, DamageHero value)
		{
			ObjectExtensions.SetFieldValue<DamageHero>((object)instance, "damageHero", value);
		}

		[SpecialName]
		public static bool get_notifiedBattleScene(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<bool>((object)instance, "notifiedBattleScene");
		}

		[SpecialName]
		public static void set_notifiedBattleScene(HealthManager instance, bool value)
		{
			ObjectExtensions.SetFieldValue<bool>((object)instance, "notifiedBattleScene", value);
		}

		[SpecialName]
		public static AudioMixerSnapshot get_deathAudioSnapshot(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<AudioMixerSnapshot>((object)instance, "deathAudioSnapshot");
		}

		[SpecialName]
		public static void set_deathAudioSnapshot(HealthManager instance, AudioMixerSnapshot value)
		{
			ObjectExtensions.SetFieldValue<AudioMixerSnapshot>((object)instance, "deathAudioSnapshot", value);
		}

		[SpecialName]
		public static GameObject get_sendKilledTo(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<GameObject>((object)instance, "sendKilledTo");
		}

		[SpecialName]
		public static void set_sendKilledTo(HealthManager instance, GameObject value)
		{
			ObjectExtensions.SetFieldValue<GameObject>((object)instance, "sendKilledTo", value);
		}

		[SpecialName]
		public static GameObject get_corpseSplatPrefab(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<GameObject>((object)instance, "corpseSplatPrefab");
		}

		[SpecialName]
		public static void set_corpseSplatPrefab(HealthManager instance, GameObject value)
		{
			ObjectExtensions.SetFieldValue<GameObject>((object)instance, "corpseSplatPrefab", value);
		}

		[SpecialName]
		public static Vector3 get_effectOrigin(HealthManager instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ObjectExtensions.GetFieldValue<Vector3>((object)instance, "effectOrigin");
		}

		[SpecialName]
		public static void set_effectOrigin(HealthManager instance, Vector3 value)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			ObjectExtensions.SetFieldValue<Vector3>((object)instance, "effectOrigin", value);
		}

		[SpecialName]
		public static EnemyDeathEffects get_enemyDeathEffects(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<EnemyDeathEffects>((object)instance, "enemyDeathEffects");
		}

		[SpecialName]
		public static void set_enemyDeathEffects(HealthManager instance, EnemyDeathEffects value)
		{
			ObjectExtensions.SetFieldValue<EnemyDeathEffects>((object)instance, "enemyDeathEffects", value);
		}

		[SpecialName]
		public static EventRelayResponder get_corpseEventResponder(HealthManager instance)
		{
			return ObjectExtensions.GetFieldValue<EventRelayResponder>((object)instance, "corpseEventResponder");
		}

		[SpecialName]
		public static void set_corpseEventResponder(HealthManager instance, EventRelayResponder value)
		{
			ObjectExtensions.SetFieldValue<EventRelayResponder>((object)instance, "corpseEventResponder", value);
		}

		[SpecialName]
		public static void Invincible(this HealthManager instance, HitInstance hitInstance1)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			ObjectExtensions.MethodInvoke((object)instance, "Invincible", new object[1] { hitInstance1 });
		}

		[SpecialName]
		public static void TakeDamage(this HealthManager instance, HitInstance hitInstance1)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			ObjectExtensions.MethodInvoke((object)instance, "TakeDamage", new object[1] { hitInstance1 });
		}

		[SpecialName]
		public static void DieDropFling(this HealthManager instance, ToolDamageFlags toolDamageFlags1, bool bool1)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			ObjectExtensions.MethodInvoke((object)instance, "DieDropFling", new object[2] { toolDamageFlags1, bool1 });
		}

		[SpecialName]
		public static void SpawnCurrency(this HealthManager instance, Transform transform1, float float1, float float2, float float3, float float4, int int1, int int2, int int3, int int4, bool bool1, int int5, bool bool2)
		{
			ObjectExtensions.MethodInvoke((object)instance, "SpawnCurrency", new object[12]
			{
				transform1, float1, float2, float3, float4, int1, int2, int3, int4, bool1,
				int5, bool2
			});
		}

		[SpecialName]
		public static void SpawnQueuedItemDrop(this HealthManager instance, QueuedDropItem healthManager_QueuedDropItem1, Transform transform1)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			ObjectExtensions.MethodInvoke((object)instance, "SpawnQueuedItemDrop", new object[2] { healthManager_QueuedDropItem1, transform1 });
		}

		[SpecialName]
		public static void SpawnItemDrop(this HealthManager instance, SavedItem savedItem1, int int1, CollectableItemPickup collectableItemPickup1, Transform transform1, int int2)
		{
			ObjectExtensions.MethodInvoke((object)instance, "SpawnItemDrop", new object[5] { savedItem1, int1, collectableItemPickup1, transform1, int2 });
		}

		[SpecialName]
		public static void NonFatalHit(this HealthManager instance, bool bool1)
		{
			ObjectExtensions.MethodInvoke((object)instance, "NonFatalHit", new object[1] { bool1 });
		}
	}
	[AccessExtensions]
	[AccessInstance<HeroController>]
	[AccessMethod("SetState", new Type[] { typeof(ActorStates) })]
	public static class HeroControllerExtensions
	{
		public sealed class <>E__0
		{
			public void SetState(ActorStates actorStates1)
			{
				throw null;
			}
		}

		[SpecialName]
		public static void SetState(this HeroController instance, ActorStates actorStates1)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			ObjectExtensions.MethodInvoke((object)instance, "SetState", new object[1] { actorStates1 });
		}
	}
}
namespace HKSS.NoEnemies.Behaviour
{
	public class NoEnemiesController : MonoBehaviour
	{
		internal static HitInstance HitInstance = new HitInstance
		{
			AttackType = (AttackTypes)1,
			CircleDirection = false,
			DamageDealt = 9999,
			Direction = 0f,
			IgnoreInvulnerable = true,
			Multiplier = 1f
		};

		internal HealthManager? HealthManager;

		private void Start()
		{
			HitInstance.Source = ((Component)HeroController.instance).gameObject;
			Utils.Logger.Debug((object)$"Enemy {((Object)((Component)this).gameObject).name} hp {HealthManager?.hp}");
			EnemyHandle();
		}

		private void EnemyHandle()
		{
			if (Configs.Mode != 0 && Configs.Mode == NoEnemiesMode.BeGone)
			{
				EnemyBeGone();
			}
		}

		private void EnemyBeGone()
		{
			//IL_003d: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			Utils.Logger.Info((object)("Enemy " + ((Object)((Component)this).gameObject).name + " be gone"));
			if (Object.op_Implicit((Object)(object)HealthManager))
			{
				HealthManager.DieDropFling(HitInstance.ToolDamageFlags, bool1: true);
				HealthManager.BeGone(null, HitInstance.AttackType, HitInstance.NailElement, HitInstance.Source, HitInstance.IgnoreInvulnerable, 0f);
			}
		}
	}
}