Decompiled source of MaskStun v1.0.0

MaskStun.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MaskStun.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MaskStun")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MaskStun")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bae5f807-647b-4919-8bfd-9157acebd4f9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MaskStun
{
	[BepInPlugin("Ex.MaskStun", "Ex Masked Enemy Stun Mod", "1.0.0")]
	public class MaskStunBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.MaskStun";

		private const string modName = "Ex Masked Enemy Stun Mod";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Ex.MaskStun");

		private static MaskStunBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.MaskStun");
			mls.LogInfo((object)"Masked Enemy Stun mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "MaskStun.dll";
			location.TrimEnd(text.ToCharArray());
			harmony.PatchAll(typeof(MaskStunBase));
			harmony.PatchAll(typeof(MaskStunPatch));
			mls.LogInfo((object)"Hit it 'til it dies!");
		}
	}
}
namespace MaskStun.Patches
{
	[HarmonyPatch(typeof(MaskedPlayerEnemy))]
	internal class MaskStunPatch
	{
		[HarmonyPatch("HitEnemy")]
		[HarmonyPostfix]
		public static void StunMaskPostFix(MaskedPlayerEnemy __instance)
		{
			((EnemyAI)__instance).stunNormalizedTimer = 0.8f;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void MaskSpeed(MaskedPlayerEnemy __instance)
		{
			if (((EnemyAI)__instance).movingTowardsTargetPlayer)
			{
				((EnemyAI)__instance).agent.speed = 6f;
			}
			else
			{
				((EnemyAI)__instance).agent.speed = 3.2f;
			}
		}
	}
}