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 LessGuaranteedCrits v1.0.0
LessGuaranteedCrits.dll
Decompiled a day 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 EntityStates; using Microsoft.CodeAnalysis; using On.EntityStates; using On.RoR2; 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("LessGuaranteedCrits")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LessGuaranteedCrits")] [assembly: AssemblyTitle("LessGuaranteedCrits")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 LessGuaranteedCrits { [BepInPlugin("Bloonjitsu7.LessGuaranteedCrits", "LessGuaranteedCrits", "1.0.0")] public class LessGuaranteedCritsPlugin : BaseUnityPlugin { public const string PluginGUID = "Bloonjitsu7.LessGuaranteedCrits"; public const string PluginAuthor = "Bloonjitsu7"; public const string PluginName = "LessGuaranteedCrits"; public const string PluginVersion = "1.0.0"; public static bool dropCooldown; public static ConfigEntry<float> CritThreshold { get; set; } public void Awake() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); CritThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("Critical Hits", "Crit Chance Threshold", 75f, "Maximum critical hit chance before it starts getting reduced. Crit chance can never reach 100%."); CharacterBody.RecalculateStats += new hook_RecalculateStats(OnRecalcCrit); } private void OnRecalcCrit(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); bool flag = self.HasBuff(Buffs.FullCrit); float crit = self.crit; if (flag) { self.crit -= 100f; } if (crit > CritThreshold.Value) { float num = 100f - CritThreshold.Value; float num2 = CritThreshold.Value; crit -= CritThreshold.Value; float num3 = 2.5f; while (0f < crit) { float num4 = Mathf.Max(0f, num - crit); crit -= num; num2 += (num - num4) / num3; num3 *= 2f; } if (flag) { num2 += 100f; } self.crit = num2; } } private bool OnRollCrit(orig_RollCrit orig, CharacterBody self) { float crit = self.crit; Log.Message(self.crit); if (crit > CritThreshold.Value) { float num = 1f - CritThreshold.Value; float num2 = CritThreshold.Value; crit -= CritThreshold.Value; int num3 = 2; while (0f < crit) { float num4 = Mathf.Max(0f, num - crit); crit -= num; num2 += (num - num4) / (float)num3; num3 *= 2; } Log.Message(num2); return Object.op_Implicit((Object)(object)self.master) && Util.CheckRoll(num2, self.master); } return Object.op_Implicit((Object)(object)self.master) && Util.CheckRoll(crit, self.master); } private bool OnEntityRollCrit(orig_RollCrit orig, BaseState self) { if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody)) { return ((EntityState)self).characterBody.RollCrit(); } return false; } } 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); } } }