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 Enemy Chaos Mod v1.0.2
Enemy Chaos.dll
Decompiled 6 months agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Enemy Chaos")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Enemy Chaos")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("45c84e66-272e-46ff-9d54-272fde4073da")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Enemy_Chaos; public class Variables { public bool Active = false; } [BepInPlugin("com.Null.Enemy_Chaos", "Enemy Chaos", "1.4.0")] public class Patcher : BaseUnityPlugin { internal static ManualLogSource Log; public void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("com.Null.enemychaos").PatchAll(); Log.LogInfo((object)"Enemy Chaos Patched – force fill enabled"); } } [HarmonyPatch(typeof(EnemyDirector))] public static class Code { [HarmonyPostfix] [HarmonyPatch("AmountSetup")] private static void PostFix(EnemyDirector __instance) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic; int num = ((__instance.enemiesDifficulty1 != null && __instance.enemiesDifficulty1.Count > 0) ? Mathf.Max(3, Random.Range(0, __instance.enemiesDifficulty1.Count + 5)) : 3); int num2 = ((__instance.enemiesDifficulty2 != null && __instance.enemiesDifficulty2.Count > 0) ? Mathf.Max(3, Random.Range(0, __instance.enemiesDifficulty2.Count + 5)) : 3); int num3 = ((__instance.enemiesDifficulty3 != null && __instance.enemiesDifficulty3.Count > 0) ? Mathf.Max(3, Random.Range(0, __instance.enemiesDifficulty3.Count + 5)) : 3); ((object)__instance).GetType().GetField("amountCurve1Value", bindingAttr)?.SetValue(__instance, Mathf.Max(num, 5)); ((object)__instance).GetType().GetField("amountCurve2Value", bindingAttr)?.SetValue(__instance, Mathf.Max(num2, 5)); ((object)__instance).GetType().GetField("amountCurve3Value", bindingAttr)?.SetValue(__instance, Mathf.Max(num3, 5)); ((object)__instance).GetType().GetField("spawnIdlePauseTimer", bindingAttr)?.SetValue(__instance, Random.Range(0.1f, 10f)); List<EnemySetup> list = ((object)__instance).GetType().GetField("enemyList", bindingAttr)?.GetValue(__instance) as List<EnemySetup>; int num4 = num + num2 + num3; int num5 = list?.Count ?? 0; int num6 = num4 - num5; List<EnemySetup> list2 = new List<EnemySetup>(); if (__instance.enemiesDifficulty1 != null) { list2.AddRange(__instance.enemiesDifficulty1); } if (__instance.enemiesDifficulty2 != null) { list2.AddRange(__instance.enemiesDifficulty2); } if (__instance.enemiesDifficulty3 != null) { list2.AddRange(__instance.enemiesDifficulty3); } if (list != null && list2.Count > 0 && num6 > 0) { for (int i = 0; i < num6; i++) { EnemySetup val = list2[Random.Range(0, list2.Count)]; list.Add(val); Patcher.Log.LogInfo((object)("[EnemyChaos] Forced extra: " + ((val != null) ? ((Object)val).name : null))); } } ((object)__instance).GetType().GetField("totalAmount", bindingAttr)?.SetValue(__instance, list?.Count ?? 0); float num7 = (float)(((object)__instance).GetType().GetField("spawnIdlePauseTimer", bindingAttr)?.GetValue(__instance) ?? ((object)0f)); Patcher.Log.LogInfo((object)($"[EnemyChaos] Requested: {num4}, Actual before fix: {num5}, " + $"Forced extras: {num6}, Final enemyList count: {list?.Count}, " + $"spawn delay {num7:F2}s")); } }