Decompiled source of BloodFueledEnemies v0.0.0

BloodFueledEnemies.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Nyxpiri.ULTRAKILL.NyxLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Nyxpiri.ULTRAKILL.BloodFueledEnemies;

public static class Cheats
{
	public const string BloodFueledEnemies = "nyxpiri.blood-fueled-enemies";
}
[BepInPlugin("nyxpiri.ultrakill.blood-fueled-enemies", "Blood Fueled Enemies", "0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("ULTRAKILL.exe")]
public class BloodFueledEnemies : BaseUnityPlugin
{
	protected void Awake()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		Log.Initialize(((BaseUnityPlugin)this).Logger);
		EnemyBloodFuel.Initialize();
		Cheats.ReadyForCheatRegistration += new ReadyForCheatRegistrationEventHandler(RegisterCheats);
		Options.Config = ((BaseUnityPlugin)this).Config;
		Options.Initialize();
		if (!File.Exists(((BaseUnityPlugin)this).Config.ConfigFilePath))
		{
			((BaseUnityPlugin)this).Config.Save();
		}
	}

	protected void OnApplicationFocus(bool hasFocus)
	{
		if (hasFocus)
		{
			((BaseUnityPlugin)this).Config.Reload();
		}
	}

	private void RegisterCheats(CheatsManager cheatsManager)
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		cheatsManager.RegisterCheat((ICheat)new ToggleCheat("Blood Fueled Enemies", "nyxpiri.blood-fueled-enemies", (Action<ToggleCheat>)delegate
		{
		}, (Action<ToggleCheat, CheatsManager>)delegate
		{
		}), "FAIRNESS AND EQUALITY");
	}

	protected void Start()
	{
	}

	protected void Update()
	{
	}

	protected void LateUpdate()
	{
	}
}
internal static class Log
{
	private static ManualLogSource _logger;

	public static void Initialize(ManualLogSource logger)
	{
		Assert.IsNull((object)_logger, "Log.Initialize called when _logger wasn't null?");
		_logger = logger;
	}

	public static void Fatal(object data)
	{
		_logger.LogFatal(data);
	}

	public static void Error(object data)
	{
		_logger.LogError(data);
	}

	public static void Warning(object data)
	{
		_logger.LogWarning(data);
	}

	public static void Message(object data)
	{
		_logger.LogMessage(data);
	}

	public static void Info(object data)
	{
		_logger.LogInfo(data);
	}

	public static void Debug(object data)
	{
		_logger.LogDebug(data);
	}
}
public static class EnemyBloodFuelEnemyComponentsExtension
{
	public static EnemyBloodFuel GetBloodFuel(this EnemyComponents enemy)
	{
		return enemy.GetMonoByIndex<EnemyBloodFuel>(EnemyBloodFuel.MonoRegistrarIdx);
	}
}
public class EnemyBloodFuel : EnemyModifier
{
	public EnemyComponents Enemy { get; private set; } = null;


	public static int MonoRegistrarIdx { get; private set; }

	internal static void Initialize()
	{
		MonoRegistrarIdx = EnemyComponents.MonoRegistrar.Register<EnemyBloodFuel>();
	}

	protected void Start()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		PlayerEvents.PreHurt += new PreHurtEventHandler(PlayerPreHurt);
		Enemy = ((Component)this).GetComponent<EnemyComponents>();
	}

	protected void OnDestroy()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		PlayerEvents.PreHurt -= new PreHurtEventHandler(PlayerPreHurt);
	}

	private void PlayerPreHurt(EventMethodCanceler canceler, PlayerComponents player, int damage, int processedDamage, bool invincible, float scoreLossMultiplier, bool explosion, bool instablack, float hardDamageMultiplier, bool ignoreInvincibility)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		if (Cheats.IsCheatEnabled("nyxpiri.blood-fueled-enemies"))
		{
			Vector3 position = ((Component)player.NewMovement.rb).transform.position;
			Vector3 position2 = ((Component)this).transform.position;
			float num = Vector3.Distance(position, position2);
			float num2 = (float)damage * Options.DistanceScalar.Value;
			float num3 = 1f - Mathf.Min(1f, num / num2);
			float num4 = (float)damage * num3;
			num4 *= Options.HealScalar.Value;
			Enemy.Health = Mathf.Min(Enemy.InitialHealth, Enemy.Health + num4);
		}
	}
}
public static class Options
{
	public static ConfigEntry<float> HealScalar;

	public static ConfigEntry<float> DistanceScalar;

	internal static ConfigFile Config;

	public static void Initialize()
	{
		HealScalar = Config.Bind<float>("Balance", "HealScalar", 0.5f, (ConfigDescription)null);
		DistanceScalar = Config.Bind<float>("Balance", "DistanceScalar", 0.25f, (ConfigDescription)null);
	}
}