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 SorceressTweaks v1.0.3
plugins/SorceressTweaks/SorceressTweaks.dll
Decompiled a year 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.Logging; using EntityStates; using HarmonyLib; using Microsoft.CodeAnalysis; using RoR2; 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: AssemblyCompany("SorceressTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SorceressTweaks")] [assembly: AssemblyTitle("SorceressTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SorceressTweaks { [BepInPlugin("yourname.sorceress.tweaks", "Sorceress Tweaks", "1.0.3")] public sealed class SorceressTweaksPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(HealthComponent), "TakeDamage")] private static class Patch_TakeDamage { private struct InvState { public bool toggledGodMode; public bool removedHiddenInv; } private static void Prefix(HealthComponent __instance, ref DamageInfo damageInfo, ref InvState __state) { __state = default(InvState); CharacterBody val = (Object.op_Implicit((Object)(object)__instance) ? __instance.body : null); if (Object.op_Implicit((Object)(object)val) && IsSorceress(val) && IsGravityWellActive(val)) { DamageInfo obj = damageInfo; obj.damage *= 0.7f; if (val.HasBuff(Buffs.HiddenInvincibility)) { val.RemoveBuff(Buffs.HiddenInvincibility); __state.removedHiddenInv = true; } if (__instance.godMode) { __instance.godMode = false; __state.toggledGodMode = true; } } } private static void Postfix(HealthComponent __instance, ref InvState __state) { CharacterBody val = (Object.op_Implicit((Object)(object)__instance) ? __instance.body : null); if (__state.removedHiddenInv && Object.op_Implicit((Object)(object)val)) { val.AddBuff(Buffs.HiddenInvincibility); } if (__state.toggledGodMode) { __instance.godMode = true; } } } public const string PluginGuid = "yourname.sorceress.tweaks"; public const string PluginName = "Sorceress Tweaks"; public const string PluginVersion = "1.0.3"; private static float _acridBaseHP; private static float _acridLevelHP; private static float _acridBaseArmor; private static bool _haveAcridStats; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("yourname.sorceress.tweaks").PatchAll(); CharacterBody.onBodyStartGlobal += ApplySorceressBaseStats; } private static void EnsureAcridStatsCached() { if (_haveAcridStats) { return; } GameObject val = BodyCatalog.FindBodyPrefab("CrocoBody"); if (Object.op_Implicit((Object)(object)val)) { CharacterBody component = val.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { _acridBaseHP = component.baseMaxHealth; _acridLevelHP = component.levelMaxHealth; _acridBaseArmor = component.baseArmor; _haveAcridStats = true; } } } private static void ApplySorceressBaseStats(CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && IsSorceress(body)) { EnsureAcridStatsCached(); if (_haveAcridStats) { body.baseMaxHealth = _acridBaseHP * 0.8f; body.levelMaxHealth = _acridLevelHP * 0.8f; body.baseArmor = _acridBaseArmor * 0.8f; body.RecalculateStats(); } } } private static bool IsSorceress(CharacterBody body) { string text = body.baseNameToken ?? ""; if (text.IndexOf("ASTERIA", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text.IndexOf("SORCERESS", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } string text2 = ((Object)body).name ?? ""; string text3 = (Object.op_Implicit((Object)(object)((Component)body).gameObject) ? (((Object)((Component)body).gameObject).name ?? "") : ""); return text2.IndexOf("Asteria", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Sorceress", StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf("Asteria", StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf("Sorceress", StringComparison.OrdinalIgnoreCase) >= 0; } private static bool IsGravityWellActive(CharacterBody body) { EntityStateMachine[] components = ((Component)body).GetComponents<EntityStateMachine>(); EntityStateMachine[] array = components; foreach (EntityStateMachine val in array) { EntityState val2 = (Object.op_Implicit((Object)(object)val) ? val.state : null); if (val2 != null) { Type type = ((object)val2).GetType(); string text = type.Name?.ToLowerInvariant() ?? ""; string text2 = type.FullName?.ToLowerInvariant() ?? ""; if ((text.Contains("gravity") && text.Contains("well")) || (text2.Contains("gravity") && text2.Contains("well"))) { return true; } } } return false; } } } namespace ExamplePlugin { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(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); } } }