using 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.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("headclef")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2+c5055692f01ad1a4cc3eeb927c08b844ae525c62")] [assembly: AssemblyProduct("Increase Tumble Damage")] [assembly: AssemblyTitle("Increase Tumble Damage")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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.2.2")] [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.2.2"; public static ConfigEntry EnableDamageOnEnemy; public static ConfigEntry MultiplierPerLevel; public static ConfigEntry MaxMultiplier; public static ConfigEntry EnableDamageOnPlayer; public static ConfigEntry UpgradesNeededForMaxReduction; public static ConfigEntry 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("Damage On Enemy", "Enable", true, "Enable scaling of damage dealt to enemies when tumble-hitting them."); MultiplierPerLevel = ((BaseUnityPlugin)this).Config.Bind("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("Damage On Enemy", "Max Multiplier", 0f, "Maximum damage multiplier cap. 0 = no cap (unlimited scaling)."); EnableDamageOnPlayer = ((BaseUnityPlugin)this).Config.Bind("Damage On Player", "Enable", true, "Enable reduction of self-damage from tumble impacts based on upgrade level."); UpgradesNeededForMaxReduction = ((BaseUnityPlugin)this).Config.Bind("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("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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0025: 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(); if ((Object)(object)componentInParent == (Object)null) { return; } BaseDamageTag baseDamageTag = default(BaseDamageTag); if (!((Component)__instance).TryGetComponent(ref baseDamageTag)) { baseDamageTag = ((Component)__instance).gameObject.AddComponent(); 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); } } 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(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 impactHurtDamage2 = Math.Max((int)((float)impactHurtDamage * num2), 0); __instance.impactHurtDamage = impactHurtDamage2; } } catch (Exception ex) { Increase_Tumble_Damage.Logger.LogError((object)("BreakImpact prefix exception: " + ex.Message)); } } } }