Decompiled source of LunarRuinDamageNerf v1.1.3

plugins/LunarRuinDamageNerf.dll

Decompiled 5 days 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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Mdh.RoR2.HealthComponent;
using Mdh.RoR2.UI.CharacterSelectController;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using Mono.Cecil.Cil;
using MonoDetour;
using MonoDetour.Cil;
using MonoDetour.DetourTypes;
using MonoDetour.HookGen;
using MonoMod.Cil;
using R2API;
using RoR2;
using RoR2.UI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LordVGames.LunarRuinDamageNerf")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3+6a43d1ecfae3543c9f2bc726ba13e178a92f3583")]
[assembly: AssemblyProduct("LordVGames.LunarRuinDamageNerf")]
[assembly: AssemblyTitle("LunarRuinDamageNerf")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 Mdh.RoR2.UI.CharacterSelectController
{
	internal static class Awake
	{
		public delegate void PrefixSignature(CharacterSelectController self);

		public delegate void PostfixSignature(CharacterSelectController self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			return typeof(CharacterSelectController).GetMethod("Awake", (BindingFlags)(-1), null, Array.Empty<Type>(), null) ?? throw new MissingMethodException("RoR2.UI.CharacterSelectController", "Awake");
		}
	}
	internal static class OnDisable
	{
		public delegate void PrefixSignature(CharacterSelectController self);

		public delegate void PostfixSignature(CharacterSelectController self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			return typeof(CharacterSelectController).GetMethod("OnDisable", (BindingFlags)(-1), null, Array.Empty<Type>(), null) ?? throw new MissingMethodException("RoR2.UI.CharacterSelectController", "OnDisable");
		}
	}
	internal static class OnEnable
	{
	}
	internal static class Update
	{
	}
	internal static class OnEntitlementsUpdated
	{
	}
	internal static class OnEventSystemDiscovered
	{
	}
	internal static class OnEventSystemLost
	{
	}
	internal static class GenerateLoadoutAssociatedUnlockableDefs
	{
	}
	internal static class UserHasAnyLoadoutUnlockables
	{
	}
	internal static class RebuildLocal
	{
	}
	internal static class RebuildOptions
	{
	}
	internal static class DeselectButton
	{
	}
	internal static class RebuildStrip
	{
	}
	internal static class BuildSkillStripDisplayData
	{
	}
	internal static class OnLoadoutChangedGlobal
	{
	}
	internal static class UpdateSurvivorInfoPanel
	{
	}
	internal static class SetSurvivorInfoPanelActive
	{
	}
	internal static class InputPlayerIsAssigned
	{
	}
	internal static class IsClientReady
	{
	}
	internal static class ClientSetReady
	{
	}
	internal static class ClientSetUnready
	{
	}
	internal static class _ctor
	{
	}
	internal static class _GenerateLoadoutAssociatedUnlockableDefs_g__TryAddUnlockableByDef_29_0
	{
	}
	internal static class SkillStrip
	{
		internal static class _ctor
		{
		}
	}
	internal static class BodyInfo
	{
		internal static class _ctor
		{
		}

		internal static class _ctor_RoR2_BodyIndex
		{
		}
	}
	internal static class StripDisplayData
	{
		internal static class _ctor
		{
		}
	}
	internal static class __c__DisplayClass29_0
	{
		internal static class _ctor
		{
		}
	}
}
namespace Mdh.RoR2.HealthComponent
{
	internal static class TakeDamageProcess
	{
		public delegate void PrefixSignature(HealthComponent self, ref DamageInfo damageInfo);

		public delegate void PostfixSignature(HealthComponent self, ref DamageInfo damageInfo);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			return typeof(HealthComponent).GetMethod("TakeDamageProcess", (BindingFlags)(-1), null, new Type[1] { typeof(DamageInfo) }, null) ?? throw new MissingMethodException("RoR2.HealthComponent", "TakeDamageProcess");
		}
	}
	internal static class Awake
	{
		public delegate void PrefixSignature(HealthComponent self);

		public delegate void PostfixSignature(HealthComponent self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			return typeof(HealthComponent).GetMethod("Awake", (BindingFlags)(-1), null, Array.Empty<Type>(), null) ?? throw new MissingMethodException("RoR2.HealthComponent", "Awake");
		}
	}
	internal static class Init
	{
		public delegate void PrefixSignature();

		public delegate void PostfixSignature();

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			return typeof(HealthComponent).GetMethod("Init", (BindingFlags)(-1), null, Array.Empty<Type>(), null) ?? throw new MissingMethodException("RoR2.HealthComponent", "Init");
		}
	}
	internal static class get_killingDamageTypeExt
	{
	}
	internal static class set_killingDamageTypeExt
	{
	}
	internal static class SetBarrier
	{
	}
	internal static class get_recentlyTookDamage
	{
	}
	internal static class get_killingDamageType
	{
	}
	internal static class set_killingDamageType
	{
	}
	internal static class get_alive
	{
	}
	internal static class get_fullHealth
	{
	}
	internal static class get_fullShield
	{
	}
	internal static class get_fullBarrier
	{
	}
	internal static class get_combinedHealth
	{
	}
	internal static class get_fullCombinedHealth
	{
	}
	internal static class get_combinedHealthFraction
	{
	}
	internal static class get_healthFraction
	{
	}
	internal static class get_missingCombinedHealth
	{
	}
	internal static class get_lastHitTime
	{
	}
	internal static class set_lastHitTime
	{
	}
	internal static class get_lastHealTime
	{
	}
	internal static class set_lastHealTime
	{
	}
	internal static class get_lastHitAttacker
	{
	}
	internal static class set_lastHitAttacker
	{
	}
	internal static class get_timeSinceLastHit
	{
	}
	internal static class get_timeSinceLastHeal
	{
	}
	internal static class get_godMode
	{
	}
	internal static class set_godMode
	{
	}
	internal static class get_potionReserve
	{
	}
	internal static class set_potionReserve
	{
	}
	internal static class get_isInFrozenState
	{
	}
	internal static class set_isInFrozenState
	{
	}
	internal static class get_distributeDamage
	{
	}
	internal static class set_distributeDamage
	{
	}
	internal static class get_isHealthLow
	{
	}
	internal static class IsHealthBelowThreshold_System_Single
	{
	}
	internal static class IsHealthBelowThreshold_System_Single_System_Single
	{
	}
	internal static class GetHealthAtThreshold
	{
	}
	internal static class add_onCharacterHealServer
	{
	}
	internal static class remove_onCharacterHealServer
	{
	}
	internal static class OnValidate
	{
	}
	internal static class Heal
	{
	}
	internal static class UsePotion
	{
	}
	internal static class HealFraction
	{
	}
	internal static class GetNormalizedHealth
	{
	}
	internal static class CmdHealFull
	{
	}
	internal static class RechargeShieldFull
	{
	}
	internal static class CmdRechargeShieldFull
	{
	}
	internal static class RechargeShield
	{
	}
	internal static class AddBarrier
	{
	}
	internal static class AddCharge
	{
	}
	internal static class CmdAddBarrier
	{
	}
	internal static class AddBarrierAuthority
	{
	}
	internal static class CmdForceShieldRegen
	{
	}
	internal static class ForceShieldRegen
	{
	}
	internal static class Die
	{
	}
	internal static class TakeDamageForce_RoR2_DamageInfo_System_Boolean_System_Boolean
	{
	}
	internal static class TakeDamageForce_UnityEngine_Vector3_System_Boolean_System_Boolean
	{
	}
	internal static class TakeDamageForce_RoR2_PhysForceInfo
	{
	}
	internal static class CmdTakeDamageForce
	{
	}
	internal static class TakeDamageForceAuthority
	{
	}
	internal static class TakeDamage
	{
	}
	internal static class ProcParry
	{
	}
	internal static class GetShieldBoosterDamage
	{
	}
	internal static class CheckElectrocutionSpread
	{
	}
	internal static class DoWarp
	{
	}
	internal static class TriggerOneShotProtection
	{
	}
	internal static class SerializedSuicide
	{
	}
	internal static class Suicide
	{
	}
	internal static class AddOnIncomingDamageServerReceiver
	{
	}
	internal static class RemoveOnIncomingDamageServerReceiver
	{
	}
	internal static class AddOnTakeDamageServerReceiver
	{
	}
	internal static class RemoveOnTakeDamageServerReceiver
	{
	}
	internal static class UpdateLastHitTime
	{
	}
	internal static class OnDestroy
	{
	}
	internal static class FixedUpdate
	{
	}
	internal static class ManagedFixedUpdate
	{
	}
	internal static class StartDeath
	{
	}
	internal static class ReviveCharacterInvisibly
	{
	}
	internal static class GetBarrierDecayRate
	{
	}
	internal static class ServerFixedUpdate
	{
	}
	internal static class SendDamageDealt
	{
	}
	internal static class HandleDamageDealt
	{
	}
	internal static class SendHeal
	{
	}
	internal static class HandleHeal
	{
	}
	internal static class OnInventoryChanged
	{
	}
	internal static class GetHealthBarValues
	{
	}
	internal static class _ctor
	{
	}
	internal static class _cctor
	{
	}
	internal static class _TakeDamageProcess_g__DoJuggle_125_1
	{
	}
	internal static class _TakeDamageProcess_g__LocalCheckRoll_125_0
	{
	}
	internal static class UNetVersion
	{
	}
	internal static class get_Networkhealth
	{
	}
	internal static class set_Networkhealth
	{
	}
	internal static class get_Networkshield
	{
	}
	internal static class set_Networkshield
	{
	}
	internal static class get_NetworkechoDamage
	{
	}
	internal static class set_NetworkechoDamage
	{
	}
	internal static class get_Network_killingDamageTypeExt
	{
	}
	internal static class set_Network_killingDamageTypeExt
	{
	}
	internal static class get_Networkbarrier
	{
	}
	internal static class set_Networkbarrier
	{
	}
	internal static class get_NetworkmagnetiCharge
	{
	}
	internal static class set_NetworkmagnetiCharge
	{
	}
	internal static class get_Network_killingDamageType
	{
	}
	internal static class set_Network_killingDamageType
	{
	}
	internal static class get_NetworkdestroyModelOnDeath
	{
	}
	internal static class set_NetworkdestroyModelOnDeath
	{
	}
	internal static class InvokeCmdCmdHealFull
	{
	}
	internal static class InvokeCmdCmdRechargeShieldFull
	{
	}
	internal static class InvokeCmdCmdAddBarrier
	{
	}
	internal static class InvokeCmdCmdForceShieldRegen
	{
	}
	internal static class InvokeCmdCmdTakeDamageForce
	{
	}
	internal static class CallCmdHealFull
	{
	}
	internal static class CallCmdRechargeShieldFull
	{
	}
	internal static class CallCmdAddBarrier
	{
	}
	internal static class CallCmdForceShieldRegen
	{
	}
	internal static class CallCmdTakeDamageForce
	{
	}
	internal static class OnSerialize
	{
	}
	internal static class OnDeserialize
	{
	}
	internal static class PreStartClient
	{
	}
	internal static class AssetReferences
	{
		internal static class Resolve
		{
		}

		internal static class __c
		{
			internal static class _cctor
			{
			}

			internal static class _ctor
			{
			}

			internal static class _Resolve_b__22_0
			{
			}

			internal static class _Resolve_b__22_1
			{
			}

			internal static class _Resolve_b__22_2
			{
			}

			internal static class _Resolve_b__22_3
			{
			}

			internal static class _Resolve_b__22_4
			{
			}

			internal static class _Resolve_b__22_5
			{
			}

			internal static class _Resolve_b__22_6
			{
			}

			internal static class _Resolve_b__22_7
			{
			}

			internal static class _Resolve_b__22_8
			{
			}

			internal static class _Resolve_b__22_9
			{
			}

			internal static class _Resolve_b__22_10
			{
			}

			internal static class _Resolve_b__22_11
			{
			}

			internal static class _Resolve_b__22_12
			{
			}

			internal static class _Resolve_b__22_13
			{
			}

			internal static class _Resolve_b__22_14
			{
			}

			internal static class _Resolve_b__22_15
			{
			}

			internal static class _Resolve_b__22_16
			{
			}

			internal static class _Resolve_b__22_17
			{
			}

			internal static class _Resolve_b__22_18
			{
			}

			internal static class _Resolve_b__22_19
			{
			}

			internal static class _Resolve_b__22_20
			{
			}

			internal static class _Resolve_b__22_21
			{
			}
		}
	}
	internal static class HealMessage
	{
		internal static class _ctor
		{
		}

		internal static class Serialize
		{
		}

		internal static class Deserialize
		{
		}
	}
	internal static class ItemCounts
	{
		internal static class _ctor
		{
		}

		internal static class _ctor_RoR2_Inventory
		{
		}
	}
	internal static class HealthBarValues
	{
		internal static class _ctor
		{
		}
	}
	internal static class RepeatHealComponent
	{
		internal static class FixedUpdate
		{
		}

		internal static class AddReserve
		{
		}

		internal static class _ctor
		{
		}
	}
	internal static class __c__DisplayClass125_0
	{
		internal static class _ctor
		{
		}
	}
	internal static class __c__DisplayClass125_1
	{
		internal static class _ctor
		{
		}
	}
}
namespace MonoDetour.HookGen
{
	internal static class DefaultMonoDetourManager
	{
		internal static MonoDetourManager Instance { get; } = New();


		internal static MonoDetourManager New()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
	internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets
	{
		public Type? TargetType { get; }

		public bool IncludeNestedTypes { get; set; }

		public string[]? Members { get; set; }

		public string[]? MemberNamePrefixes { get; set; }

		public string[]? MemberNameSuffixes { get; set; }

		public bool GenerateControlFlowVariants { get; set; }

		public MonoDetourTargetsAttribute(Type? targetType = null)
		{
			TargetType = targetType;
			IncludeNestedTypes = true;
			base..ctor();
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace LunarRuinDamageNerf
{
	public static class ConfigOptions
	{
		private const string _configSectionName = "Lunar Ruin Damage Nerf";

		public static ConfigEntry<bool> DamageIncreaseForSkillsOnly;

		public static ConfigEntry<float> DamageIncreasePerLunarRuin;

		public static ConfigEntry<bool> EnableDiminishingDamage;

		public static ConfigEntry<float> LunarRuinDamageCap;

		public static ConfigEntry<bool> EnableLoggingDamageIncrease;

		private static void OnConfigOptionChanged(object sender, EventArgs e)
		{
			Main.UpdateLunarRuinDescription();
		}

		internal static void BindConfigOptions(ConfigFile config)
		{
			DamageIncreaseForSkillsOnly = Extensions.BindOption<bool>(config, "Lunar Ruin Damage Nerf", "Make lunar ruins damage increase only apply to skill damage", "If enabled, will make the damage increase from lunar ruin only apply to skill damage and not proc/item damage.", true, (ConfigFlags)0);
			DamageIncreasePerLunarRuin = Extensions.BindOptionSlider<float>(config, "Lunar Ruin Damage Nerf", "Damage increase per lunar ruin stack", "The increase to incoming damage for each stack of lunar ruin. Value is a percentage, so 5 means lunar ruin will increase all incoming damage by 5%. Vanilla's value is 10.", 10f, (ConfigFlags)0);
			EnableDiminishingDamage = Extensions.BindOption<bool>(config, "Lunar Ruin Damage Nerf", "Enable diminishing/hyperbolic scaling for lunar ruin`s damage increase.", "If enabled, will make the damage increase for each stack of lunar ruin smaller and smaller as it approaches the cap. Vanilla does not use this.\nOld default: true", false, (ConfigFlags)0);
			LunarRuinDamageCap = Extensions.BindOptionSteppedSlider(config, "Lunar Ruin Damage Nerf", "Lunar ruin damage cap", "The maximum damage increase that stacking lunar ruin can reach. Vanilla does not have a maximum damage increase. Set to -1 for no maximum damage boost.\nOld default: 145", -1f, 1f, -1f, 1000f, (ConfigFlags)0);
			EnableLoggingDamageIncrease = Extensions.BindOption<bool>(config, "Lunar Ruin Damage Nerf", "Enable logging the new damage increase from lunar ruin.", "If you're re-configuring the mod and want to know how much of a damage increase lunar ruin is giving, enable this option.", false, (ConfigFlags)0);
			DamageIncreaseForSkillsOnly.SettingChanged += OnConfigOptionChanged;
			DamageIncreasePerLunarRuin.SettingChanged += OnConfigOptionChanged;
			EnableDiminishingDamage.SettingChanged += OnConfigOptionChanged;
			LunarRuinDamageCap.SettingChanged += OnConfigOptionChanged;
			Extensions.WipeConfig(config);
		}
	}
	internal static class ILHooks
	{
		[MonoDetourTargets(typeof(HealthComponent))]
		private static class LunarRuinEdit
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static Manipulator <0>__DoEdit;

				public static Func<HealthComponent, DamageInfo, float> <1>__ChangeDamageIncrease;
			}

			[MonoDetourHookInitialize]
			internal static void Setup()
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Expected O, but got Unknown
				object obj = <>O.<0>__DoEdit;
				if (obj == null)
				{
					Manipulator val = DoEdit;
					<>O.<0>__DoEdit = val;
					obj = (object)val;
				}
				TakeDamageProcess.ILHook((Manipulator)obj);
			}

			private static void DoEdit(ILManipulationInfo info)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				ILWeaver w = new ILWeaver(info);
				w.DefineLabel();
				int lunarRuinDamageIncreaseILVariableNumber = 28;
				Instruction startOfVanillaLine = null;
				Instruction endOfVanillaLine = null;
				w.MatchRelaxed(new Predicate<Instruction>[8]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0) && w.SetCurrentTo(x) && w.SetInstructionTo(ref startOfVanillaLine, x),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"),
					(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC2Content/Buffs", "lunarruin"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "GetBuffCount"),
					(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.1f),
					(Instruction x) => ILPatternMatchingExt.MatchMul(x),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref lunarRuinDamageIncreaseILVariableNumber) && w.SetInstructionTo(ref endOfVanillaLine, x)
				}).ThrowIfFailure().InsertBeforeCurrent((IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[4]
				{
					w.Create(OpCodes.Ldarg_0),
					w.Create(OpCodes.Ldarg_1),
					w.CreateCall((Delegate)new Func<HealthComponent, DamageInfo, float>(ChangeDamageIncrease)),
					w.Create(OpCodes.Stloc, lunarRuinDamageIncreaseILVariableNumber)
				}));
				w.InsertBranchOver(startOfVanillaLine, endOfVanillaLine);
			}

			private static float ChangeDamageIncrease(HealthComponent healthComponent, DamageInfo damageInfo)
			{
				int buffCount = healthComponent.body.GetBuffCount(Buffs.lunarruin);
				float num;
				if (ConfigOptions.DamageIncreaseForSkillsOnly.Value && !((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased)
				{
					num = 0f;
				}
				else
				{
					float num2 = ConfigOptions.DamageIncreasePerLunarRuin.Value * (float)buffCount;
					num = (ConfigOptions.EnableDiminishingDamage.Value ? Main.GetHyperbolic(ConfigOptions.DamageIncreasePerLunarRuin.Value, ConfigOptions.LunarRuinDamageCap.Value, num2) : ((ConfigOptions.LunarRuinDamageCap.Value == -1f) ? num2 : MathF.Min(num2, ConfigOptions.LunarRuinDamageCap.Value)));
				}
				if (ConfigOptions.EnableLoggingDamageIncrease.Value)
				{
					Log.Info($"Lunar ruin's damage increase went from +{(float)buffCount * 0.1f * 100f}% to +{num}%");
				}
				return num *= 0.01f;
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	internal static class Main
	{
		[MonoDetourTargets(typeof(CharacterSelectController))]
		internal static class CSCManagement
		{
			internal static CharacterSelectController CharacterSelectController;

			internal static bool IsCharacterSelectControllerValid
			{
				get
				{
					if ((Object)(object)CharacterSelectController == (Object)null)
					{
						return false;
					}
					if ((Object)(object)CharacterSelectController.characterSelectBarController == (Object)null)
					{
						return false;
					}
					return true;
				}
			}

			[MonoDetourHookInitialize]
			private static void Setup()
			{
				Mdh.RoR2.UI.CharacterSelectController.Awake.Postfix(CharacterSelectController_Awake);
				OnDisable.Postfix(CharacterSelectController_OnDisable);
			}

			private static void CharacterSelectController_Awake(CharacterSelectController self)
			{
				CharacterSelectController = self;
			}

			private static void CharacterSelectController_OnDisable(CharacterSelectController self)
			{
				CharacterSelectController = null;
			}
		}

		[CompilerGenerated]
		private sealed class <DelaySelectFalseSon>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SurvivorDef falseSonDef;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelaySelectFalseSon>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!CSCManagement.IsCharacterSelectControllerValid)
					{
						return false;
					}
					CSCManagement.CharacterSelectController.characterSelectBarController.PickIconBySurvivorDef(falseSonDef);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal static float GetHyperbolic(float firstStack, float cap, float chance)
		{
			if (firstStack >= cap)
			{
				return cap * (chance / firstStack);
			}
			float num = chance / firstStack;
			float num2 = 100f * firstStack / (cap - firstStack);
			return cap * (1f - 100f / (num * num2 + 100f));
		}

		internal static void UpdateLunarRuinDescription()
		{
			Log.Debug("UpdateLunarRuinDescription");
			string text = "";
			bool flag = false;
			if (ConfigOptions.LunarRuinDamageCap.Value != -1f)
			{
				text = Language.GetStringFormatted("KEYWORD_LUNARRUIN_DAMAGECAPPED", new object[1] { ConfigOptions.LunarRuinDamageCap.Value });
				flag = true;
			}
			if (ConfigOptions.EnableDiminishingDamage.Value)
			{
				if (ConfigOptions.LunarRuinDamageCap.Value != -1f)
				{
					text += " ";
				}
				text += Language.GetString("KEYWORD_LUNARRUIN_HYPERBOLICSTACKING");
				flag = true;
			}
			if (flag)
			{
				text = " " + text;
			}
			Log.Debug(text);
			string text2 = ((!ConfigOptions.DamageIncreaseForSkillsOnly.Value) ? Language.GetStringFormatted("KEYWORD_LUNARRUIN_NERFED", new object[2]
			{
				ConfigOptions.DamageIncreasePerLunarRuin.Value,
				text
			}) : Language.GetStringFormatted("KEYWORD_LUNARRUIN_NERFED_SKILLSONLY", new object[2]
			{
				ConfigOptions.DamageIncreasePerLunarRuin.Value,
				text
			}));
			Log.Debug(text2);
			LanguageAPI.AddOverlay("KEYWORD_LUNARRUIN", text2);
			ReselectFalseSonIfSelected();
		}

		private static void ReselectFalseSonIfSelected()
		{
			if (CSCManagement.IsCharacterSelectControllerValid && !((Object)(object)CSCManagement.CharacterSelectController.currentSurvivorDef.bodyPrefab.GetComponent<CharacterBody>() != (Object)(object)BodyPrefabs.FalseSonBody))
			{
				SurvivorDef currentSurvivorDef = CSCManagement.CharacterSelectController.currentSurvivorDef;
				SurvivorDef val = SurvivorCatalog.orderedSurvivorDefs.Where((SurvivorDef survivorDef) => survivorDef.displayNameToken == "COMMANDO_BODY_NAME").ElementAt(0);
				CSCManagement.CharacterSelectController.characterSelectBarController.PickIconBySurvivorDef(val);
				((MonoBehaviour)CSCManagement.CharacterSelectController).StartCoroutine(DelaySelectFalseSon(currentSurvivorDef));
			}
		}

		[IteratorStateMachine(typeof(<DelaySelectFalseSon>d__4))]
		private static IEnumerator DelaySelectFalseSon(SurvivorDef falseSonDef)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelaySelectFalseSon>d__4(0)
			{
				falseSonDef = falseSonDef
			};
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("LordVGames.LunarRuinDamageNerf", "LunarRuinDamageNerf", "1.1.3")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Id = "LordVGames.LunarRuinDamageNerf";

		public static string Name => "LunarRuinDamageNerf";

		public static string Version => "1.1.3";

		public void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			ConfigOptions.BindConfigOptions(((BaseUnityPlugin)this).Config);
			MonoDetourManager.InvokeHookInitializers(typeof(Plugin).Assembly);
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				Main.UpdateLunarRuinDescription();
			});
		}
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}