Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of IncreaseTumbleDamage v1.1.0
Increase Tumble Damage.dll
Decompiled 2 months agousing System; using System.Diagnostics; 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 Character_Stats; using HarmonyLib; using Microsoft.CodeAnalysis; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("headclef")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+f11773f0a4ca66a338ce5bb794105723c2dafa85")] [assembly: AssemblyProduct("Increase Tumble Damage")] [assembly: AssemblyTitle("Increase Tumble Damage")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [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 Increase_Tumble_Damage { [BepInPlugin("headclef.IncreaseTumbleDamage", "Increase Tumble Damage", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Increase_Tumble_Damage : BaseUnityPlugin { private const string PluginGuid = "headclef.IncreaseTumbleDamage"; private const string PluginName = "Increase Tumble Damage"; private const string PluginVersion = "1.1.0"; internal static ConfigEntry<bool> EnableDamageOnEnemy; internal static ConfigEntry<float> MultiplierPerLevel; internal static ConfigEntry<float> MaxMultiplier; internal static ConfigEntry<bool> EnableDamageOnPlayer; internal static ConfigEntry<int> UpgradesNeededForMaxReduction; internal static ConfigEntry<float> MaxDamageReduction; internal static Increase_Tumble_Damage Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; BindConfiguration(); Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } private void BindConfiguration() { EnableDamageOnEnemy = ((BaseUnityPlugin)this).Config.Bind<bool>("Damage On Enemy", "Enable", true, "Enable scaling of damage dealt to enemies when tumble-hitting them."); MultiplierPerLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Damage On Enemy", "Multiplier Per Level", 1.1f, "Damage multiplier per Tumble Launch upgrade level. Final multiplier = level × this value. E.g. 1.1 means level 1 = 1.1×, level 10 = 11×."); MaxMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Damage On Enemy", "Max Multiplier", 0f, "Maximum damage multiplier cap. 0 = no cap (unlimited scaling)."); EnableDamageOnPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("Damage On Player", "Enable", true, "Enable reduction of self-damage from tumble impacts based on upgrade level."); UpgradesNeededForMaxReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage On Player", "Upgrades Needed For Max Reduction", 10, "Number of Tumble Launch upgrades required to reach maximum self-damage reduction."); MaxDamageReduction = ((BaseUnityPlugin)this).Config.Bind<float>("Damage On Player", "Max Damage Reduction", 1f, "Maximum self-damage reduction ratio from tumble impacts. E.g. 0.75 = 75% reduction (100 dmg -> 25)."); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace Increase_Tumble_Damage.Patches { [HarmonyPatch] internal static class TumbleLaunchDamagePatch { public class BaseDamageTag : MonoBehaviour { public int baseDamage; } [HarmonyPatch(typeof(HurtCollider), "EnemyHurt")] [HarmonyPrefix] private static void EnemyHurt_Prefix(HurtCollider __instance) { if (!Increase_Tumble_Damage.EnableDamageOnEnemy.Value) { return; } try { PlayerTumble componentInParent = ((Component)__instance).GetComponentInParent<PlayerTumble>(); if ((Object)(object)componentInParent == (Object)null) { return; } BaseDamageTag baseDamageTag = default(BaseDamageTag); if (!((Component)__instance).TryGetComponent<BaseDamageTag>(ref baseDamageTag)) { baseDamageTag = ((Component)__instance).gameObject.AddComponent<BaseDamageTag>(); baseDamageTag.baseDamage = __instance.enemyDamage; } PlayerAvatar playerAvatar = componentInParent.playerAvatar; if ((Object)(object)playerAvatar == (Object)null) { return; } string text = SemiFunc.PlayerGetSteamID(playerAvatar); int upgradeLevel = Character_Stats.GetUpgradeLevel(text, "Launch"); float value = Increase_Tumble_Damage.MultiplierPerLevel.Value; float value2 = Increase_Tumble_Damage.MaxMultiplier.Value; if (!(value <= 0f) && upgradeLevel > 0) { float num = value * (float)upgradeLevel; if (value2 > 0f) { num = Math.Min(num, value2); } __instance.enemyDamage = Mathf.RoundToInt((float)baseDamageTag.baseDamage * num); Increase_Tumble_Damage.Logger.LogInfo((object)$"EnemyHurt TUMBLE: damage {baseDamageTag.baseDamage} -> {__instance.enemyDamage} (multiplier: {num:F2}, upgrades: {upgradeLevel})"); } } catch (Exception ex) { Increase_Tumble_Damage.Logger.LogError((object)("EnemyHurt prefix exception: " + ex.Message)); } } [HarmonyPatch(typeof(HurtCollider), "EnemyHurt")] [HarmonyPostfix] private static void EnemyHurt_Postfix(HurtCollider __instance) { BaseDamageTag baseDamageTag = default(BaseDamageTag); if (((Component)__instance).TryGetComponent<BaseDamageTag>(ref baseDamageTag)) { __instance.enemyDamage = baseDamageTag.baseDamage; } } [HarmonyPatch(typeof(PlayerTumble), "BreakImpact")] [HarmonyPrefix] private static void BreakImpact_Prefix(PlayerTumble __instance) { if (!Increase_Tumble_Damage.EnableDamageOnPlayer.Value || __instance.impactHurtDamage <= 0) { return; } try { int value = Increase_Tumble_Damage.UpgradesNeededForMaxReduction.Value; float value2 = Increase_Tumble_Damage.MaxDamageReduction.Value; if (!(value2 <= 0f) && value >= 0) { string text = SemiFunc.PlayerGetSteamID(__instance.playerAvatar); int upgradeLevel = Character_Stats.GetUpgradeLevel(text, "Launch"); float num = ((value != 0) ? (value2 * Math.Min((float)upgradeLevel / (float)value, 1f)) : value2); float num2 = 1f - num; int impactHurtDamage = __instance.impactHurtDamage; int num3 = (__instance.impactHurtDamage = Math.Max((int)((float)impactHurtDamage * num2), 0)); Increase_Tumble_Damage.Logger.LogInfo((object)$"BreakImpact SCALED: impactHurtDamage {impactHurtDamage} -> {num3} (reduction: {num:P0}, upgrades: {upgradeLevel})"); } } catch (Exception ex) { Increase_Tumble_Damage.Logger.LogError((object)("BreakImpact prefix exception: " + ex.Message)); } } } }