Decompiled source of IncreasePlayerDamage v1.0.0

DoubleDamage.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("DoubleDamage")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1dc4f372bb6d9d23709e4731b498fd296d32681f")]
[assembly: AssemblyProduct("DoubleDamage")]
[assembly: AssemblyTitle("DoubleDamage")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Silksong.DoubleDamage
{
	[BepInPlugin("stebars.silksong.double-damage", "Double Damage", "1.0.0")]
	public sealed class DoubleDamagePlugin : BaseUnityPlugin
	{
		internal static ManualLogSource LogSrc;

		internal static ConfigEntry<float> DamageMult;

		private void Awake()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			LogSrc = ((BaseUnityPlugin)this).Logger;
			DamageMult = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PlayerDamageMultiplier", 2f, "Multiplier for all hero damage");
			new Harmony("stebars.silksong.double-damage").PatchAll();
			LogSrc.LogInfo((object)$"Double Damage loaded. Multiplier = {DamageMult.Value}");
		}
	}
	[HarmonyPatch(typeof(HealthManager), "TakeDamage")]
	internal static class Patch_HealthManager_TakeDamage
	{
		private static void Prefix(ref HitInstance hitInstance)
		{
			if (hitInstance.IsHeroDamage)
			{
				hitInstance.Multiplier *= DoubleDamagePlugin.DamageMult.Value;
				ManualLogSource logSrc = DoubleDamagePlugin.LogSrc;
				if (logSrc != null)
				{
					logSrc.LogDebug((object)$"Applied hero damage mult: {DoubleDamagePlugin.DamageMult.Value} -> final Multiplier={hitInstance.Multiplier}");
				}
			}
		}
	}
}