Decompiled source of BillionDifficulty v1.6.1
BillionDifficulty.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BillionDifficulty.EnemyPatches; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using ULTRAKILL.Cheats; using ULTRAKILL.Enemy; using ULTRAKILL.Portal; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BillionDifficulty")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.6.1.0")] [assembly: AssemblyInformationalVersion("1.6.1+1bdbff3fd512df4540d848f834a7dc01d63c21f9")] [assembly: AssemblyProduct("Billion Difficulty")] [assembly: AssemblyTitle("BillionDifficulty")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.6.1.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 BillionDifficulty { public class Util { public static bool IsDifficulty(int difficulty) { return MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0) == difficulty; } public static int GetDifficulty() { return MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0); } public static Texture2D LoadEmbeddedTexture(string resourceName) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resourceName); if (stream == null) { Plugin.Logger.LogError((object)("Embedded resource '" + resourceName + "' not found")); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { return val; } Plugin.Logger.LogError((object)"Failed to load embedded texture"); return null; } } [BepInPlugin("billy.billiondifficulty", "Billion Difficulty", "1.6.1")] [BepInProcess("ULTRAKILL.exe")] public class Plugin : BaseUnityPlugin { private static readonly Harmony Harmony = new Harmony("billy.billiondifficulty"); internal static ManualLogSource Logger; public static bool loadedAssets = false; public static Texture2D blueFilthTexture = Util.LoadEmbeddedTexture("BillionDifficulty.assets.zombie_MeleeHusk_MouthOpen_Diffuse.png"); public static Texture2D blueFilthBiteTexture = Util.LoadEmbeddedTexture("BillionDifficulty.assets.zombie_MeleeHusk_MouthClosed_Diffuse.png"); public static GameObject ProjectileExplosiveHH; public static GameObject ProjectileHoming; public static GameObject Projectile; public static GameObject GasolineProjectile; public static GameObject ExplosionSuper; public static GameObject Explosion; public static GameObject PumpChargeSound; public void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Harmony.PatchAll(); Logger.LogInfo((object)"Plugin BillionDifficulty is loaded! WOAHHHH"); SceneManager.activeSceneChanged += SceneManager_activeSceneChanged; GetAssets(); } public void SceneManager_activeSceneChanged(Scene arg0, Scene arg1) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) string text = "b3e7f2f8052488a45b35549efb98d902"; Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (name == text) { AddDifficultyButton(); } } public T Ass<T>(string path) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion(); } public void GetAssets() { if (!loadedAssets) { ProjectileExplosiveHH = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile Explosive HH.prefab"); ProjectileHoming = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile Homing.prefab"); Projectile = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile.prefab"); GasolineProjectile = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/GasolineProjectile.prefab"); ExplosionSuper = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Super.prefab"); Explosion = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab"); PumpChargeSound = Ass<GameObject>("Assets/Particles/SoundBubbles/PumpChargeSound.prefab"); loadedAssets = true; } } public Transform FindCanvas() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); return (from obj in ((Scene)(ref activeScene)).GetRootGameObjects() where ((Object)obj).name == "Canvas" select obj).First().transform; } public void AddDifficultyButton() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) Transform val = FindCanvas(); Transform val2 = val.Find("Difficulty Select (1)").Find("Interactables"); Transform transform = Object.Instantiate<GameObject>(((Component)val2.Find("Brutal")).gameObject, val2).transform; DifficultySelectButton component = ((Component)transform).GetComponent<DifficultySelectButton>(); component.difficulty = 19; transform.position += new Vector3(700f, 82.5f); TextMeshProUGUI component2 = ((Component)transform.Find("Name")).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).text = "BILLION"; ((Graphic)component2).color = Color.white; Button component3 = ((Component)component).GetComponent<Button>(); ((Selectable)component3).interactable = true; Transform val3 = val2.Find("Brutal Info"); Transform difficultyInfo = Object.Instantiate<GameObject>(((Component)val3).gameObject, val3.parent).transform; Transform val4 = difficultyInfo.Find("Text"); ((Component)difficultyInfo.Find("Text")).GetComponent<TMP_Text>().text = "<color=white>A step up from the brutal difficulty. Faster enemies, changed attacks. Designed to make the game harder while not being annoying.</color>\n\n<color=purple>Requires quick reflexes, knowledge of your arsenal and the enemies.</color>"; TMP_Text component4 = (TMP_Text)(object)((Component)difficultyInfo.Find("Title (1)")).GetComponent<TextMeshProUGUI>(); component4.fontSize = 46f; component4.text = "--BILLION--"; EventTrigger component5 = ((Component)component).GetComponent<EventTrigger>(); component5.triggers.Clear(); Entry val5 = new Entry(); val5.eventID = (EventTriggerType)0; ((UnityEvent<BaseEventData>)(object)val5.callback).AddListener((UnityAction<BaseEventData>)delegate { ((Component)difficultyInfo).gameObject.SetActive(true); }); component5.triggers.Add(val5); Entry val6 = new Entry(); val6.eventID = (EventTriggerType)1; ((UnityEvent<BaseEventData>)(object)val6.callback).AddListener((UnityAction<BaseEventData>)delegate { ((Component)difficultyInfo).gameObject.SetActive(false); }); component5.triggers.Add(val6); Entry val7 = new Entry(); val7.eventID = (EventTriggerType)4; ((UnityEvent<BaseEventData>)(object)val7.callback).AddListener((UnityAction<BaseEventData>)delegate { ((Component)difficultyInfo).gameObject.SetActive(false); }); component5.triggers.Add(val7); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "BillionDifficulty"; public const string PLUGIN_NAME = "Billion Difficulty"; public const string PLUGIN_VERSION = "1.6.1"; } } namespace BillionDifficulty.SetupPatches { [HarmonyPatch(typeof(PrefsManager), "EnsureValid")] public class EnsureValidPatch { public static bool Prefix(ref object __result, string key, object value) { if (key != "difficulty" || (int)value != 19) { return true; } __result = 19; return false; } } [HarmonyPatch(typeof(DifficultyTitle), "Check")] public class DifficultyTitlePatch { public static void Postfix(DifficultyTitle __instance) { if (!Util.IsDifficulty(19)) { return; } __instance.txt2.text = (__instance.lines ? "-- BILLION --" : "BILLION"); FinalRank[] array = Object.FindObjectsByType<FinalRank>((FindObjectsSortMode)0); if (array != null && array.Length != 0) { FinalRank val = array[0]; Transform val2 = ((Component)val).transform.Find("Title"); string text = ((TMP_Text)((Component)val2.Find("Text")).GetComponent<TextMeshProUGUI>()).text; bool flag = false; string arg = "ffffff"; if (text.StartsWith("8-4:")) { flag = true; arg = "ffaaaa"; } else if (text.StartsWith("P-1:")) { flag = true; arg = "aaffff"; } else if (text.StartsWith("P-2:")) { flag = true; arg = "ffccaa"; } else if (text.StartsWith("0-E:")) { flag = true; arg = "aaccff"; } else if (text.StartsWith("1-E:")) { flag = true; arg = "aaaaaa"; } else if (text.StartsWith("2-E:")) { flag = true; arg = "ffbb99"; } else if (text.StartsWith("3-E:")) { flag = true; arg = "ccffaa"; } else if (text.StartsWith("9-2:") || text.StartsWith("P-") || text.Contains("-E")) { flag = true; } if (flag) { string text2 = $"<color=#{arg}>BILLION</color>S MUST HAVE FUN"; __instance.txt2.text = (__instance.lines ? ("-- " + text2 + " --") : text2); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class CanSubmitScoresPatch { public static bool Prefix(ref bool __result) { if (!Util.IsDifficulty(19)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(StatsManager), "SendInfo")] public class SendInfoPatch { public static void Postfix() { if (Util.IsDifficulty(19)) { Plugin.Logger.LogWarning((object)("Score submitted: " + LeaderboardController.CanSubmitScores)); } } } [HarmonyPatch(typeof(FinalCyberRank), "GameOver")] public class CyberGameOverPatch { public static void Postfix() { if (Util.IsDifficulty(19)) { Plugin.Logger.LogWarning((object)("Score submitted: " + LeaderboardController.CanSubmitScores)); } } } [HarmonyPatch(typeof(PresenceController), "Start")] public class PresenceControllerPatch { public static void Prefix(PresenceController __instance) { if (__instance.diffNames.Length < 20) { Array.Resize(ref __instance.diffNames, 20); __instance.diffNames[19] = "BILLION"; } } } [HarmonyPatch(typeof(GameProgressSaver), "GetProgress")] public class GetProgressPatch { public static bool Prefix(int difficulty, ref int __result) { int num = 1; int[] array = new int[7] { 0, 1, 2, 3, 4, 5, 19 }; int i = ((ReadOnlySpan<int>)array).IndexOf(difficulty); if (i == -1) { i = 0; } for (; i < array.Length; i++) { GameProgressData gameProgress = GameProgressSaver.GetGameProgress(array[i]); if (gameProgress != null && gameProgress.difficulty == array[i] && gameProgress.levelNum > num) { num = gameProgress.levelNum; } } __result = num; return false; } } [HarmonyPatch(typeof(GameProgressSaver), "GetPrime")] public class GetPrimePatch { public static bool Prefix(ref int difficulty, ref int level, ref int __result) { if (SceneHelper.IsPlayingCustom) { __result = 0; return false; } level--; int num = 0; int[] array = new int[7] { 0, 1, 2, 3, 4, 5, 19 }; int i = ((ReadOnlySpan<int>)array).IndexOf(difficulty); if (i == -1) { i = 0; } for (; i < array.Length; i++) { GameProgressData gameProgress = GameProgressSaver.GetGameProgress(array[i]); if (gameProgress != null && gameProgress.difficulty == array[i] && gameProgress.primeLevels != null && gameProgress.primeLevels.Length > level && gameProgress.primeLevels[level] > num) { Debug.Log((object)("Highest: . Data: " + gameProgress.primeLevels[level])); if (gameProgress.primeLevels[level] >= 2) { __result = 2; return false; } num = gameProgress.primeLevels[level]; } } __result = num; return false; } } [HarmonyPatch(typeof(GameProgressSaver), "GetEncoreProgress")] public class GetEncoreProgressPatch { public static bool Prefix(int difficulty, ref int __result) { int num = 0; int[] array = new int[7] { 0, 1, 2, 3, 4, 5, 19 }; int i = ((ReadOnlySpan<int>)array).IndexOf(difficulty); if (i == -1) { i = 0; } for (; i < array.Length; i++) { GameProgressData gameProgress = GameProgressSaver.GetGameProgress(array[i]); if (gameProgress != null && gameProgress.difficulty == array[i] && gameProgress.encores > num) { num = gameProgress.encores; } } __result = num; return false; } } [HarmonyPatch(typeof(GameProgressSaver), "DifficultySavePath")] public class DifficultySavePathPatch { public static void Postfix(int diff, ref object __result) { if (diff == 19) { __result = Path.Combine(GameProgressSaver.BaseSavePath, $"Slot{GameProgressSaver.currentSlot + 1}", "difficulty19progress.bepis"); } } } [HarmonyPatch(typeof(GameProgressSaver), "LevelProgressPath")] public class LevelProgressPathPatch { public static bool Prefix(int lvl, ref string __result) { if (!Util.IsDifficulty(19)) { return true; } string text = Path.Combine(GameProgressSaver.SavePath, $"difficulty19lvl{lvl}progress.bepis"); __result = text; return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class CGPathPatch { public static bool Prefix(ref string __result) { if (Util.GetDifficulty() != 19) { return true; } __result = Path.Combine(GameProgressSaver.SavePath, "cybergrindhighscore19.bepis"); return false; } } [HarmonyPatch(typeof(GameProgressSaver), "GetDirectorySlotData")] public class GetDirectorySlotDataPatch { public static bool Prefix(string path, ref object __result) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown if (!Util.IsDifficulty(19)) { return true; } Debug.Log((object)("Generating SlotData for " + path)); int num = 0; int num2 = 0; object obj = GameProgressSaver.ReadFile(Path.Combine(path, "difficulty19progress.bepis")); GameProgressData val = (GameProgressData)((obj is GameProgressData) ? obj : null); if (val != null && (val.levelNum > num || (val.levelNum == num && val.difficulty > num2))) { num = val.levelNum; num2 = val.difficulty; } __result = (object)new SlotData { exists = true, highestDifficulty = num2, highestLvlNumber = num }; return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class RankDataConstructorPatch { public static bool Prefix(StatsManager sman, RankData __instance) { //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown int difficulty = Util.GetDifficulty(); __instance.levelNumber = sman.levelNumber; RankData rank = GameProgressSaver.GetRank(true, -1); if (rank != null) { __instance.ranks = rank.ranks; if (rank.majorAssists != null) { __instance.majorAssists = rank.majorAssists; } else { __instance.majorAssists = new bool[20]; } if (rank.stats != null) { __instance.stats = rank.stats; } else { __instance.stats = (RankScoreData[])(object)new RankScoreData[20]; } if ((sman.rankScore >= rank.ranks[difficulty] && (rank.majorAssists == null || (!sman.majorUsed && rank.majorAssists[difficulty]))) || sman.rankScore > rank.ranks[difficulty] || rank.levelNumber != __instance.levelNumber) { __instance.majorAssists[difficulty] = sman.majorUsed; __instance.ranks[difficulty] = sman.rankScore; if (__instance.stats[difficulty] == null) { __instance.stats[difficulty] = new RankScoreData(); } __instance.stats[difficulty].kills = sman.kills; __instance.stats[difficulty].style = sman.stylePoints; __instance.stats[difficulty].time = sman.seconds; } __instance.secretsAmount = sman.secretObjects.Length; __instance.secretsFound = new bool[__instance.secretsAmount]; for (int i = 0; i < __instance.secretsAmount && i < rank.secretsFound.Length; i++) { if ((Object)(object)sman.secretObjects[i] == (Object)null || rank.secretsFound[i]) { __instance.secretsFound[i] = true; } } __instance.challenge = rank.challenge; return false; } __instance.ranks = new int[20]; __instance.stats = (RankScoreData[])(object)new RankScoreData[20]; if (__instance.stats[difficulty] == null) { __instance.stats[difficulty] = new RankScoreData(); } __instance.majorAssists = new bool[20]; for (int j = 0; j < __instance.ranks.Length; j++) { __instance.ranks[j] = -1; } __instance.ranks[difficulty] = sman.rankScore; __instance.majorAssists[difficulty] = sman.majorUsed; __instance.stats[difficulty].kills = sman.kills; __instance.stats[difficulty].style = sman.stylePoints; __instance.stats[difficulty].time = sman.seconds; __instance.secretsAmount = sman.secretObjects.Length; __instance.secretsFound = new bool[__instance.secretsAmount]; for (int k = 0; k < __instance.secretsAmount; k++) { if ((Object)(object)sman.secretObjects[k] == (Object)null) { __instance.secretsFound[k] = true; } } return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class GetRankDataPatch { public static bool Prefix(ref string path, int lvl, bool returnNull, ref RankData __result) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!Util.IsDifficulty(19)) { return true; } GameProgressSaver.PrepareFs(); string resolveCurrentLevelPath = GameProgressSaver.resolveCurrentLevelPath; string text = GameProgressSaver.LevelProgressPath(lvl); if (text == "") { return false; } path = ((lvl < 0) ? resolveCurrentLevelPath : text); object obj = GameProgressSaver.ReadFile(path); RankData val = (RankData)((obj is RankData) ? obj : null); if (val == null) { val = (returnNull ? ((RankData)null) : new RankData(MonoSingleton<StatsManager>.Instance)); if (val == null) { __result = null; return false; } } if (val.ranks.Length < 20) { Array.Resize(ref val.ranks, 20); val.ranks[19] = -1; } if (val.majorAssists.Length < 20) { Array.Resize(ref val.majorAssists, 20); } if (val.secretsFound.Length < 20) { Array.Resize(ref val.secretsFound, 20); } if (val.stats.Length < 20) { Array.Resize(ref val.stats, 20); } __result = val; return false; } } [HarmonyPatch(typeof(GameProgressSaver), "GetCyberRankData")] public class GetCyberRankDataPatch { public static bool Prefix(ref CyberRankData __result) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (Util.GetDifficulty() != 19) { return true; } string cyberGrindHighScorePath = GameProgressSaver.cyberGrindHighScorePath; object obj = GameProgressSaver.ReadFile(cyberGrindHighScorePath); CyberRankData val = (CyberRankData)((obj is CyberRankData) ? obj : null); if (val == null) { val = new CyberRankData(); } if (val.preciseWavesByDifficulty == null) { val.preciseWavesByDifficulty = new float[20]; } else if (val.preciseWavesByDifficulty.Length < 20) { Array.Resize(ref val.preciseWavesByDifficulty, 20); } if (val.style == null) { val.style = new int[20]; } else if (val.style.Length < 20) { Array.Resize(ref val.style, 20); } if (val.kills == null) { val.kills = new int[20]; } else if (val.kills.Length < 20) { Array.Resize(ref val.kills, 20); } if (val.time == null) { val.time = new float[20]; } else if (val.time.Length < 20) { Array.Resize(ref val.time, 20); } __result = val; return false; } } } namespace BillionDifficulty.GenaralPatches { [HarmonyPatch(typeof(NewMovement))] public class NewMovementPatch { [HarmonyPrefix] [HarmonyPatch(typeof(NewMovement), "GetHurt")] public static bool GetHurtPrefix(NewMovement __instance, out float __state) { __state = __instance.antiHp; return true; } [HarmonyPostfix] [HarmonyPatch(typeof(NewMovement), "GetHurt")] public static void GetHurtPostfix(NewMovement __instance, float __state) { if (__instance.difficulty == 19) { float num = __instance.antiHp - __state; if (num > 0f) { num *= 1.4285715f; __instance.antiHp = __state + num; } } } [HarmonyPrefix] [HarmonyPatch(typeof(NewMovement), "Respawn")] public static void RespawnPrefix(NewMovement __instance) { if (__instance.difficulty == 19) { StreetcleanerAfterburn[] array = Object.FindObjectsByType<StreetcleanerAfterburn>((FindObjectsSortMode)0); StreetcleanerAfterburn[] array2 = array; foreach (StreetcleanerAfterburn streetcleanerAfterburn in array2) { streetcleanerAfterburn.ticks = streetcleanerAfterburn.tickCount; } } } } [HarmonyPatch(typeof(EnemyIdentifier), "Start")] public class RadianceSpeedPatch1 { public static void Postfix(EnemyIdentifier __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if (!Util.IsDifficulty(19)) { return; } EnemyType enemyType = __instance.enemyType; EnemyType val = enemyType; if ((int)val <= 20) { if ((int)val != 9) { if ((int)val == 19) { goto IL_0057; } if ((int)val != 20) { goto IL_0064; } } __instance.speedBuffModifier = 1.1f; return; } if ((int)val == 26 || (int)val == 38 || (int)val == 40) { goto IL_0057; } goto IL_0064; IL_0064: __instance.speedBuffModifier = 1.25f; return; IL_0057: __instance.speedBuffModifier = 1.15f; } } [HarmonyPatch(typeof(EnemyIdentifier), "SpeedBuff", new Type[] { typeof(float) })] public class RadianceSpeedPatch2 { public static bool Prefix(float modifier, EnemyIdentifier __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 if (__instance.difficulty != 19) { return true; } __instance.speedBuffRequests++; EnemyType enemyType = __instance.enemyType; EnemyType val = enemyType; if ((int)val <= 20) { if ((int)val != 9) { if ((int)val == 19) { goto IL_006a; } if ((int)val != 20) { goto IL_0077; } } __instance.speedBuffModifier = 1.1f; goto IL_0084; } if ((int)val == 26 || (int)val == 38 || (int)val == 40) { goto IL_006a; } goto IL_0077; IL_0084: __instance.UpdateBuffs(false, true); return false; IL_0077: __instance.speedBuffModifier = 1.25f; goto IL_0084; IL_006a: __instance.speedBuffModifier = 1.15f; goto IL_0084; } } [HarmonyPatch(typeof(Projectile), "Explode")] public class ExplosionPatch { public static bool Prefix(ref Projectile __instance) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) if (!__instance.active) { return false; } __instance.active = false; if (__instance.keepTrail) { __instance.KeepTrail(); } GameObject val = Object.Instantiate<GameObject>(__instance.explosionEffect, ((Component)__instance).transform.position - __instance.rb.velocity * 0.02f, ((Component)__instance).transform.rotation); Explosion[] componentsInChildren = val.GetComponentsInChildren<Explosion>(); foreach (Explosion val2 in componentsInChildren) { val2.sourceWeapon = __instance.sourceWeapon ?? val2.sourceWeapon; if (__instance.bigExplosion) { val2.maxSize *= 1.5f; } if (val2.damage != 0) { val2.damage = Mathf.RoundToInt(__instance.damage); } val2.enemy = true; if (__instance.difficulty != 19) { continue; } BillionExplosionController component = ((Component)val2).gameObject.GetComponent<BillionExplosionController>(); if ((Object)(object)component != (Object)null) { val2.maxSize *= component.maxSizeMultiplier; val2.speed *= component.speedMultiplier; val2.enemyDamageMultiplier *= component.enemyDamageMultiplier; if (component.damage == -1) { val2.damage = Mathf.RoundToInt(component.damageMultiplier * (float)val2.damage); } else { val2.damage = component.damage; } } } MonoSingleton<StainVoxelManager>.Instance.TryIgniteAt(((Component)__instance).transform.position, 3); Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } [HarmonyPatch(typeof(EndlessGrid))] public class EndlessGridPatch { [HarmonyPrefix] [HarmonyPatch(typeof(EndlessGrid), "NextWave")] public static void NextWavePrefix() { if (Util.IsDifficulty(19)) { EndlessGridPatch.DestroyAllOfType<SandificationZone>(); EndlessGridPatch.DestroyAllOfType<SlowDownOverTime>(); EndlessGridPatch.DestroyAllOfType<SlowDownOverTimeEase>(); } } public static void DestroyAllOfType<T>() where T : Object { T[] array = Object.FindObjectsByType<T>((FindObjectsSortMode)0); T[] array2 = array; foreach (T val in array2) { object obj = val; object obj2 = ((obj is Component) ? obj : null); Object.Destroy((Object)(object)((obj2 != null) ? ((Component)((Component)obj2).transform.root).gameObject : null)); } } } [HarmonyPatch(typeof(StyleHUD))] public class StyleHUDPatch { [HarmonyPostfix] [HarmonyPatch(typeof(StyleHUD), "Start")] public static void StartPostfix(StyleHUD __instance) { if (!__instance.idNameDict.ContainsKey("billion.blue")) { __instance.idNameDict.Add("billion.blue", "<color=#00ffffff>I'M BLUE</color>"); } } } [HarmonyPatch(typeof(ZombieMelee), "Start")] public class BlueFilthPatch { public static void Postfix(ZombieMelee __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown if (__instance.difficulty == 19 && (int)__instance.eid.enemyType == 3 && Random.Range(0, 300) == 0) { Material val = Object.Instantiate<Material>(__instance.originalMaterial); Material val2 = Object.Instantiate<Material>(__instance.biteMaterial); val.mainTexture = (Texture)(object)Plugin.blueFilthTexture; val2.mainTexture = (Texture)(object)Plugin.blueFilthBiteTexture; __instance.originalMaterial = val; __instance.biteMaterial = val2; SkinnedMeshRenderer[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val3 in componentsInChildren) { ((Renderer)val3).material = val; MaterialPropertyBlock val4 = new MaterialPropertyBlock(); ((Renderer)val3).GetPropertyBlock(val4); val4.SetTexture("_MainTex", (Texture)(object)Plugin.blueFilthTexture); ((Renderer)val3).SetPropertyBlock(val4); } } } } } namespace BillionDifficulty.EnemyPatches { [HarmonyPatch(typeof(CancerousRodent))] public class CancerousRodentPatch { [HarmonyPostfix] [HarmonyPatch(typeof(CancerousRodent), "Start")] public static void StartPostfix(CancerousRodent __instance) { if (Util.IsDifficulty(19)) { __instance.projectileAmount = 5; } } [HarmonyPostfix] [HarmonyPatch(typeof(CancerousRodent), "Update")] public static void UpdatePostfix(CancerousRodent __instance) { if (Util.IsDifficulty(19) && __instance.coolDown > 2f) { __instance.coolDown -= 1f; } } } [HarmonyPatch(typeof(Spin))] public class SpinPatch { [HarmonyPrefix] [HarmonyPatch(typeof(Spin), "Start")] public static void StartPrefix(Spin __instance) { if (Object.op_Implicit((Object)(object)__instance.eid) && __instance.eid.difficultyOverride >= 0) { __instance.difficulty = __instance.eid.difficultyOverride; } else { __instance.difficulty = Util.GetDifficulty(); } if (__instance.difficulty == 19 && ((Object)((Component)__instance).transform).name == "LaserRing" && __instance.difficultyVariance) { __instance.difficultySpeedMultiplier *= 1.3f; } } } [HarmonyPatch(typeof(Countdown), "GetCountdownLength")] public class CountdownPatch { public static bool Prefix(Countdown __instance, ref float __result) { if (!__instance.changePerDifficulty) { __result = __instance.countdownLength; return false; } if (__instance.difficulty == 19) { __result = __instance.countdownLengthPerDifficulty[4]; return false; } __result = __instance.countdownLengthPerDifficulty[__instance.difficulty]; return false; } } [HarmonyPatch(typeof(DifficultyDependantObject), "Awake")] public class DifficultyDependantObjectPatch { public static bool Prefix(ref DifficultyDependantObject __instance) { if (!Util.IsDifficulty(19)) { return true; } __instance.veryHard = true; UnityEvent onRightDifficulty = __instance.onRightDifficulty; if (onRightDifficulty == null) { return false; } onRightDifficulty.Invoke(); return false; } } [HarmonyPatch(typeof(FleshPrison))] public class FleshPrisonPatch { [HarmonyPrefix] [HarmonyPatch(typeof(FleshPrison), "SpawnInsignia")] public static bool SpawnInsigniaPrefix(FleshPrison __instance) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) if (__instance.difficulty != 19) { return true; } if (__instance.eid.target == null) { return false; } __instance.inAction = false; GameObject val = Object.Instantiate<GameObject>(__instance.insignia, __instance.eid.target.position, Quaternion.identity); if (__instance.altVersion) { Vector3 velocity = __instance.eid.target.GetVelocity(); velocity.y = 0f; if (((Vector3)(ref velocity)).magnitude > 0f) { val.transform.LookAt(__instance.eid.target.position + velocity); } else { val.transform.Rotate(Vector3.up * Random.Range(0f, 360f), (Space)1); } val.transform.Rotate(Vector3.right * 90f, (Space)1); } VirtueInsignia val2 = default(VirtueInsignia); if (val.TryGetComponent<VirtueInsignia>(ref val2)) { val2.predictive = true; val2.noTracking = true; val2.otherParent = ((Component)__instance).transform; val2.charges = ((__instance.stat.health > __instance.maxHealth / 2f) ? 2 : 3); VirtueInsignia obj = val2; obj.charges += 3; val2.windUpSpeedMultiplier = 0.5f; VirtueInsignia obj2 = val2; obj2.windUpSpeedMultiplier *= __instance.eid.totalSpeedModifier; val2.damage = Mathf.RoundToInt((float)val2.damage * __instance.eid.totalDamageModifier); val2.target = __instance.eid.target; val2.predictiveVersion = null; Light val3 = val.AddComponent<Light>(); val3.range = 30f; val3.intensity = 50f; } float num = 8f; switch (__instance.difficulty) { case 0: num = 5f; break; case 1: num = 7f; break; case 2: case 3: case 4: case 5: case 19: num = 8f; break; } val.transform.localScale = new Vector3(num, 2f, num); val.transform.SetParent(((Component)GoreZone.ResolveGoreZone(((Component)__instance).transform)).transform, true); if (__instance.fleshDroneCooldown < 1f) { __instance.fleshDroneCooldown = 1f; } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(FleshPrison), "ProjectileBurstUpdate")] public static bool ProjectileBurstUpdatePrefix(FleshPrison __instance) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) if (__instance.difficulty != 19) { return true; } __instance.homingProjectileCooldown = Mathf.MoveTowards(__instance.homingProjectileCooldown, 0f, Time.deltaTime * (Mathf.Abs(__instance.rotationSpeed) / 10f) * __instance.eid.totalSpeedModifier); if (__instance.homingProjectileCooldown <= 0f) { GameObject val = Object.Instantiate<GameObject>(__instance.homingProjectile, __instance.rotationBone.position + __instance.rotationBone.up * 8f, __instance.rotationBone.rotation); Projectile component = val.GetComponent<Projectile>(); component.target = __instance.eid.target; component.safeEnemyType = (EnemyType)(__instance.altVersion ? 30 : 17); switch (__instance.difficulty) { case 0: component.turningSpeedMultiplier = 0.4f; break; case 1: component.turningSpeedMultiplier = 0.45f; break; case 2: case 3: component.turningSpeedMultiplier = 0.5f; break; case 4: case 5: case 19: component.turningSpeedMultiplier = 0.66f; break; } if (__instance.altVersion) { component.turnSpeed *= 4f; component.turningSpeedMultiplier *= 4f; component.predictiveHomingMultiplier = 1.25f; Rigidbody val2 = default(Rigidbody); if (val.TryGetComponent<Rigidbody>(ref val2)) { val2.AddForce(Vector3.up * 50f, (ForceMode)2); } } component.damage *= __instance.eid.totalDamageModifier; __instance.homingProjectileCooldown = 1f; __instance.currentProjectile++; val.transform.SetParent(((Component)__instance).transform, true); } if (__instance.currentProjectile >= __instance.projectileAmount) { __instance.inAction = false; Animator anim = __instance.anim; if ((Object)(object)anim != (Object)null) { anim.SetBool("Shooting", false); } __instance.rotationSpeedTarget = ((__instance.rotationSpeed >= 0f) ? 45 : (-45)); if (__instance.fleshDroneCooldown < 1f) { __instance.fleshDroneCooldown = 1f; } } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(FleshPrison), "SpawnFleshDrones")] public static bool SpawnFleshDronesPrefix(FleshPrison __instance) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) if (__instance.difficulty != 19) { return true; } if (__instance.eid.target == null) { return false; } float num = 360f / (float)__instance.droneAmount; if (__instance.currentDrone == 0) { __instance.targeter = new GameObject("Targeter"); __instance.targeter.transform.position = __instance.rotationBone.position; Vector3 val = (__instance.altVersion ? Vector3.up : (new Vector3(__instance.eid.target.position.x, __instance.targeter.transform.position.y, __instance.eid.target.position.z) - __instance.targeter.transform.position)); Quaternion rotation = (__instance.altVersion ? Quaternion.LookRotation(((Vector3)(ref val)).normalized) : Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up)); __instance.targeter.transform.rotation = rotation; __instance.targeter.transform.Rotate(Vector3.forward * num / 2f); } if (__instance.currentDrone < __instance.droneAmount) { __instance.secondaryBarValue = (float)__instance.currentDrone / (float)__instance.droneAmount; GameObject val2 = Object.Instantiate<GameObject>((__instance.currentDrone % 2 == 0) ? __instance.skullDrone : __instance.fleshDrone, __instance.targeter.transform.position + __instance.targeter.transform.up * (float)(__instance.altVersion ? 50 : 20), __instance.targeter.transform.rotation); val2.transform.SetParent(((Component)__instance).transform, true); EnemyIdentifier val3 = default(EnemyIdentifier); if (val2.TryGetComponent<EnemyIdentifier>(ref val3)) { val3.dontCountAsKills = true; val3.damageBuff = __instance.eid.damageBuff; val3.healthBuff = __instance.eid.healthBuff; val3.speedBuff = __instance.eid.speedBuff; } DroneFlesh item = default(DroneFlesh); if (val2.TryGetComponent<DroneFlesh>(ref item)) { __instance.currentDrones.Add(item); } __instance.targeter.transform.Rotate(Vector3.forward * num); __instance.currentDrone++; ((MonoBehaviour)__instance).Invoke("SpawnFleshDrones", 0.1f / __instance.eid.totalSpeedModifier); return false; } __instance.inAction = false; __instance.rotationSpeedTarget = ((Random.Range(0, 2) == 0) ? 45 : (-45)); __instance.aud.Stop(); __instance.shakingCamera = false; __instance.currentDrone = 0; Object.Destroy((Object)(object)__instance.targeter); __instance.fleshDroneCooldown = (__instance.altVersion ? 30 : 25); __instance.healing = false; return false; } } [HarmonyPatch(typeof(GabrielBase))] public class GabrielBasePatch { [HarmonyPostfix] [HarmonyPatch(typeof(GabrielBase), "UpdateSpeed")] public static void UpdateSpeedPostfix(GabrielBase __instance) { if (__instance.difficulty == 19) { __instance.anim.speed = 1.15f * __instance.eid.totalSpeedModifier; __instance.defaultAnimSpeed = __instance.anim.speed; } } } [HarmonyPatch(typeof(Gabriel))] public class GabrielPatch { [HarmonyPrefix] [HarmonyPatch(typeof(Gabriel), "SpearCombo")] public static bool SpearComboPrefix(Gabriel __instance) { if (__instance.difficulty != 19) { return true; } switch (__instance.difficulty) { case 0: __instance.gabe.forwardSpeed = 60f; break; case 1: __instance.gabe.forwardSpeed = 75f; break; case 2: case 3: case 4: case 5: case 19: __instance.gabe.forwardSpeed = 150f; break; } GabrielBase gabe = __instance.gabe; gabe.forwardSpeed *= __instance.eid.totalSpeedModifier; __instance.spearAttacks = 1; if (__instance.gabe.enraged) { __instance.spearAttacks++; } if (__instance.gabe.secondPhase) { __instance.spearAttacks++; } __instance.SpawnRightHandWeapon((GabrielWeaponType)3); __instance.gabe.inAction = true; __instance.anim.Play("SpearReady"); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(Gabriel), "SpearAttack")] public static bool SpearAttackPrefix(Gabriel __instance) { //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) if (__instance.difficulty != 19) { return true; } if (__instance.gabe.juggled) { return false; } if (__instance.target == null) { __instance.spearAttacks = 0; } if (__instance.spearAttacks == 0) { __instance.SpearThrow(); return false; } __instance.gabe.spearing = true; __instance.gabe.goForward = false; __instance.spearAttacks--; float num = 1.5f; switch (__instance.difficulty) { case 0: case 1: num = 2f; break; case 2: num = 1.5f; break; case 3: case 4: case 5: num = 0.75f; break; case 19: num = 0.6f; break; } ((MonoBehaviour)__instance).Invoke("SpearAttack", num / __instance.eid.totalSpeedModifier); num = 0.75f; switch (__instance.difficulty) { case 0: case 1: num = 1f; break; case 2: num = 0.75f; break; case 3: case 4: case 5: num = 0.5f; break; case 19: num = 0.4f; break; } Vector3 val = __instance.target.headPosition; bool flag = false; RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(__instance.target.headPosition, Vector3.up, ref val2, 17f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1)) { val = __instance.target.headPosition + Vector3.up * 15f; flag = true; } else if (!Physics.Raycast(__instance.target.headPosition, Vector3.down, ref val2, 17f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1)) { val = ((Component)__instance).transform.position + Vector3.down * 15f; flag = true; } if (!flag || (__instance.difficulty >= 4 && __instance.gabe.enraged && Random.Range(0f, 1f) > 0.5f)) { __instance.anim.Play("SpearStinger"); __instance.gabe.Teleport(false, true, true, true, false); __instance.gabe.FollowTarget(); ((MonoBehaviour)__instance).Invoke("SpearFlash", num / 2f / __instance.eid.totalSpeedModifier); ((MonoBehaviour)__instance).Invoke("SpearGoHorizontal", num / __instance.eid.totalSpeedModifier); return false; } __instance.gabe.TeleportTo(val); __instance.gabe.LookAtTarget(0); Animator anim = __instance.anim; if ((Object)(object)anim != (Object)null) { anim.Play("SpearDown"); } ((MonoBehaviour)__instance).Invoke("SpearFlash", num / 2f / __instance.eid.totalSpeedModifier); ((MonoBehaviour)__instance).Invoke("SpearGo", num / __instance.eid.totalSpeedModifier); return false; } } [HarmonyPatch(typeof(Geryon))] public class GeryonPatch { [HarmonyPostfix] [HarmonyPatch(typeof(Geryon), "UpdateDifficulty")] public static void UpdateDifficultyPostfix(Geryon __instance) { if (__instance.difficulty == 19) { __instance.anim.speed = 1.3f; __instance.maximumHeat = 9f; if (__instance.secondPhase) { Animator anim = __instance.anim; anim.speed *= 1.25f; } } } [HarmonyPrefix] [HarmonyPatch(typeof(Geryon), "Stun")] public static void StunPrefix(Geryon __instance) { if (__instance.difficulty == 19) { __instance.stunTime = 5f; } } } [HarmonyPatch(typeof(LeviathanHead))] public class LeviathanHeadPatch { [HarmonyPostfix] [HarmonyPatch(typeof(LeviathanHead), "SetSpeed")] public static void SetSpeedPostfix(LeviathanHead __instance) { if (__instance.lcon.difficulty == 19) { __instance.anim.speed = 1.6f * __instance.lcon.eid.totalSpeedModifier; } } } [HarmonyPatch(typeof(LeviathanTail))] public class LeviathanTailPatch { [HarmonyPostfix] [HarmonyPatch(typeof(LeviathanTail), "GetAnimSpeed")] public static void GetAnimSpeedPostfix(LeviathanTail __instance, ref float __result) { if (__instance.lcon.difficulty == 19) { __result = 2f; } } } [HarmonyPatch(typeof(Mandalore))] public class MandalorePatch { [HarmonyPostfix] [HarmonyPatch(typeof(Mandalore), "Update")] public static void UpdatePostfix(Mandalore __instance) { if (Util.IsDifficulty(19)) { __instance.cooldown -= 1f * Time.deltaTime; } } } [HarmonyPatch(typeof(MinosBoss))] public class MinosPatch { [HarmonyPostfix] [HarmonyPatch(typeof(MinosBoss), "SetSpeed")] public static void SetSpeedPostfix(MinosBoss __instance) { if (__instance.difficulty == 19) { __instance.anim.speed = 1.6f * __instance.eid.totalSpeedModifier; } } [HarmonyPostfix] [HarmonyPatch(typeof(MinosBoss), "SpawnBlackHole")] public static void SpawnBlackHolePostfix(MinosBoss __instance) { if (__instance.difficulty == 19) { BlackHoleProjectile currentBlackHole = __instance.currentBlackHole; currentBlackHole.speed *= 1.8f; } } [HarmonyPrefix] [HarmonyPatch(typeof(MinosBoss), "Update")] public static bool UpdatePrefix(MinosBoss __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (__instance.difficulty != 19) { return true; } if (__instance.dead) { AnimatorStateInfo currentAnimatorStateInfo = __instance.anim.GetCurrentAnimatorStateInfo(0); if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Death")) { __instance.anim.Play("Death"); } } if ((Object)(object)__instance.currentBlackHole == (Object)null && __instance.blackHoleCooldown > 0f && (__instance.phase < 2 || __instance.difficulty > 2)) { __instance.blackHoleCooldown = Mathf.MoveTowards(__instance.blackHoleCooldown, 0f, Time.deltaTime * __instance.eid.totalSpeedModifier); } if (Object.op_Implicit((Object)(object)__instance.stat) && __instance.stat.health < __instance.originalHealth / 2f && __instance.phase < 2 && !__instance.anim.IsInTransition(0)) { __instance.inPhaseChange = true; __instance.PhaseChange(2); } if (__instance.eid.target == null) { return false; } if (__instance.inAction || __instance.inPhaseChange) { return false; } if ((Object)(object)__instance.currentBlackHole == (Object)null && __instance.blackHoleCooldown == 0f && __instance.difficulty >= 2 && (__instance.phase < 2 || __instance.difficulty > 2)) { __instance.BlackHole(); return false; } if (__instance.cooldown > 0f) { __instance.cooldown = Mathf.MoveTowards(__instance.cooldown, 0f, Time.deltaTime * __instance.anim.speed); return false; } if (__instance.anim.IsInTransition(0)) { return false; } if (__instance.phase == 1 && __instance.difficulty < 4) { __instance.cooldown = ((__instance.difficulty >= 4) ? 1f : 2f); } else if (__instance.phase == 2 || __instance.difficulty >= 4) { if ((__instance.difficulty == 4 && __instance.punchesSinceBreak < 2) || __instance.difficulty == 5 || __instance.difficulty == 19) { __instance.punchesSinceBreak++; __instance.cooldown = 0f; } else { __instance.punchesSinceBreak = 0; __instance.cooldown = 3f; } } else { __instance.cooldown = 0f; } if (__instance.onRight) { if (__instance.onMiddle && Random.Range(0f, 1f) > 0.5f) { __instance.SlamMiddle(); return false; } __instance.SlamRight(); return false; } if (__instance.onLeft) { if (__instance.onMiddle && Random.Range(0f, 1f) > 0.5f) { __instance.SlamMiddle(); return false; } __instance.SlamLeft(); return false; } __instance.SlamMiddle(); return false; } } [HarmonyPatch(typeof(MinosArm))] public class MinosArmPatch { [HarmonyPostfix] [HarmonyPatch(typeof(MinosArm), "SetSpeed")] public static void SetSpeedPostfix(MinosArm __instance) { if (__instance.difficulty == 19) { __instance.maxSlams = 99; __instance.originalAnimSpeed = 1.375f * __instance.eid.totalSpeedModifier; __instance.anim.speed = __instance.originalAnimSpeed * (1f + __instance.speedState / 4f); } } } [HarmonyPatch(typeof(MinosPrime))] public class MinosPrimePatch { [HarmonyPostfix] [HarmonyPatch(typeof(MinosPrime), "SetSpeed")] public static void SetSpeedPostfix(MinosPrime __instance) { if (__instance.difficulty == 19) { __instance.anim.speed = 1.35f * __instance.eid.totalSpeedModifier; } } } [HarmonyPatch(typeof(Minotaur))] public class MinotaurPatch { [HarmonyPrefix] [HarmonyPatch(typeof(Minotaur), "GetSpeed")] public static bool GetSpeedPrefix(int difficulty, Minotaur __instance, ref EnemyMovementData __result) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (difficulty != 19) { return true; } float num = 1.4f; __result = new EnemyMovementData { speed = 50f * num, angularSpeed = 12000f, acceleration = 100f }; return false; } [HarmonyPostfix] [HarmonyPatch(typeof(Minotaur), "SetSpeed")] public static void SetSpeedPostfix(Minotaur __instance) { if (__instance.difficulty == 19) { float num = 1.4f; __instance.anim.speed = num * __instance.eid.totalSpeedModifier; __instance.nma.speed = 50f * __instance.anim.speed; } } } [HarmonyPatch(typeof(MinotaurChase))] public class MinotaurChasePatch { [HarmonyPostfix] [HarmonyPatch(typeof(MinotaurChase), "SetSpeed")] public static void SetSpeedPostfix(MinotaurChase __instance) { if (__instance.difficulty == 19) { __instance.movementSpeed = 40f * __instance.eid.totalSpeedModifier; __instance.anim.speed = 1.4f * __instance.eid.totalSpeedModifier; } } } [HarmonyPatch(typeof(SisyphusPrime))] public class SisyphusPrimePatch { [HarmonyPostfix] [HarmonyPatch(typeof(SisyphusPrime), "SetSpeed")] public static void SetSpeedPostfix(SisyphusPrime __instance) { if (__instance.difficulty == 19) { __instance.anim.speed = 1.35f * __instance.eid.totalSpeedModifier; } } } [HarmonyPatch(typeof(V2))] public class V2Patch { [HarmonyPrefix] [HarmonyPatch(typeof(V2), "SetSpeed")] public static bool SetSpeedPrefix(V2 __instance) { if (__instance.difficulty != 19) { return true; } if (!Object.op_Implicit((Object)(object)__instance.nma)) { __instance.nma = ((Component)__instance).GetComponent<NavMeshAgent>(); } if (!Object.op_Implicit((Object)(object)__instance.eid)) { __instance.eid = ((Component)__instance).GetComponent<EnemyIdentifier>(); } if (__instance.difficulty < 0) { __instance.difficulty = Enemy.InitializeDifficulty(__instance.eid); } if (__instance.originalMovementSpeed != 0f) { __instance.movementSpeed = __instance.originalMovementSpeed; } else { switch (__instance.difficulty) { case 0: __instance.movementSpeed *= 0.65f; break; case 1: __instance.movementSpeed *= 0.75f; break; case 2: __instance.movementSpeed *= 0.85f; break; case 3: __instance.movementSpeed *= 1f; break; case 4: case 5: case 19: __instance.movementSpeed *= 1.5f; break; } __instance.movementSpeed *= __instance.eid.totalSpeedModifier; __instance.originalMovementSpeed = __instance.movementSpeed; } if (__instance.enraged) { __instance.movementSpeed *= 2f; } if (Object.op_Implicit((Object)(object)__instance.nma)) { __instance.nma.speed = __instance.originalMovementSpeed; } GameObject[] weapons = __instance.weapons; for (int i = 0; i < weapons.Length; i++) { ((Component)weapons[i].transform.GetChild(0)).SendMessage("UpdateBuffs", (object)__instance.eid, (SendMessageOptions)1); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(V2), "UpdateCooldowns")] public static bool UpdateCooldownsPrefix(V2 __instance) { if (__instance.difficulty != 19) { return true; } if (__instance.patternCooldown > 0f) { __instance.patternCooldown = Mathf.MoveTowards(__instance.patternCooldown, 0f, Time.deltaTime); } if (__instance.shootCooldown > 0f || __instance.altShootCooldown > 0f) { float num = 1f; if (__instance.difficulty == 1) { num = 0.85f; } if (__instance.difficulty == 0) { num = 0.75f; } if (__instance.difficulty == 19) { num = 1.25f; } if (__instance.shootCooldown > 0f) { __instance.shootCooldown = Mathf.MoveTowards(__instance.shootCooldown, 0f, Time.deltaTime * num * (__instance.cowardPattern ? 0.5f : 1f) * __instance.eid.totalSpeedModifier); } if (__instance.altShootCooldown > 0f) { __instance.altShootCooldown = Mathf.MoveTowards(__instance.altShootCooldown, 0f, Time.deltaTime * num * __instance.eid.totalSpeedModifier); } } if (__instance.dodgeCooldown < 6f) { float num2 = 1f; switch (__instance.difficulty) { case 0: case 1: case 2: num2 = 0.1f; break; case 3: num2 = 0.5f; break; case 4: case 5: num2 = 1f; break; case 19: num2 = 1.25f; break; } __instance.dodgeCooldown = Mathf.MoveTowards(__instance.dodgeCooldown, 6f, Time.deltaTime * num2 * __instance.eid.totalSpeedModifier); } if (__instance.dodgeLeft > 0f) { __instance.dodgeLeft = Mathf.MoveTowards(__instance.dodgeLeft, 0f, Time.deltaTime * 3f * __instance.eid.totalSpeedModifier); if (__instance.dodgeLeft <= 0f) { __instance.DodgeEnd(); } } if (__instance.secondEncounter && (__instance.coins.Count == 0 || (__instance.aboutToShoot && __instance.shootingForCoin))) { switch (__instance.difficulty) { case 0: __instance.coinsInSightCooldown = 0.8f; break; case 1: __instance.coinsInSightCooldown = 0.6f; break; case 2: __instance.coinsInSightCooldown = 0.4f; break; case 3: __instance.coinsInSightCooldown = 0.2f; break; case 4: case 5: case 19: __instance.coinsInSightCooldown = 0f; break; } } if (__instance.inPattern) { __instance.DistancePatience(); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(V2), "Dodge")] public static bool DodgePrefix(Transform projectile, V2 __instance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Invalid comparison between Unknown and I4 //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) if (__instance.difficulty != 19) { return true; } if (__instance.target == null || !__instance.active) { return false; } if (__instance.dodgeLeft > 0f) { return false; } if (__instance.chargingAlt) { return false; } if (Vector3.Distance(((Component)__instance).transform.position, __instance.target.position) <= 15f) { return false; } if (__instance.dodgeCooldown >= 1.5f) { __instance.dodgeCooldown -= 1.5f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Component)__instance).transform.position.x - projectile.position.x, 0f, ((Component)__instance).transform.position.z - projectile.position.z); if ((int)__instance.currentPattern == 2) { Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = __instance.targetPos - ((Component)__instance).transform.position; val = normalized + ((Vector3)(ref val2)).normalized; } __instance.DodgeNow(val); __instance.ChangeDirection((float)((Random.Range(0f, 1f) > 0.5f) ? 90 : (-90))); return false; } if (__instance.gc.onGround && !__instance.jumping && !__instance.slideOnly) { if (__instance.cowardPattern) { __instance.Jump(); return false; } float num = Random.Range(0f, (__instance.difficulty >= 3) ? 2f : 3f); if (num > 1f) { return false; } if (num > 0.75f) { __instance.Jump(); return false; } __instance.Slide(); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(V2), "ShootCheck")] public static bool ShootCheckPrefix(V2 __instance) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (__instance.difficulty != 19) { return true; } float num = Vector3.Distance(__instance.target.position, ((Component)__instance).transform.position); if (!__instance.aboutToShoot) { if (num <= 15f) { __instance.SwitchWeapon(1); } else if (__instance.weapons.Length > 2 && num < 25f && __instance.eid.stuckMagnets.Count <= 0) { __instance.SwitchWeapon(2); } else { __instance.SwitchWeapon(0); } } if (Physics.Raycast(((Component)__instance).transform.position + Vector3.up * 2f, __instance.target.position - ((Component)__instance).transform.position, ref __instance.rhit, Vector3.Distance(((Component)__instance).transform.position, __instance.target.position), LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)))) { if (__instance.altShootCooldown <= 0f && (Object)(object)((RaycastHit)(ref __instance.rhit)).transform != (Object)null && ((Component)((RaycastHit)(ref __instance.rhit)).transform).gameObject.CompareTag("Breakable")) { __instance.predictAmount = 0f; __instance.aimAtGround = false; if (__instance.distancePatience >= 4f) { __instance.shootCooldown = 1f; } else { __instance.shootCooldown = ((__instance.difficulty > 2) ? Random.Range(1f, 2f) : 2f); } __instance.altShootCooldown = 5f; ((Component)__instance.weapons[__instance.currentWeapon].transform.GetChild(0)).SendMessage("PrepareAltFire"); __instance.aboutToShoot = true; __instance.chargingAlt = true; ((MonoBehaviour)__instance).Invoke("AltShootWeapon", 1f / __instance.eid.totalSpeedModifier); } return false; } __instance.aboutToShoot = true; if (__instance.altShootCooldown <= 0f || (__instance.distancePatience >= 8f && __instance.currentWeapon == 0 && !__instance.dontEnrage)) { __instance.aimAtGround = __instance.currentWeapon != 0 || __instance.weapons.Length == 1; if (__instance.currentWeapon == 0) { __instance.predictAmount = 0.15f / __instance.eid.totalSpeedModifier; } else if (__instance.currentWeapon == 1 || __instance.difficulty > 2) { __instance.predictAmount = 0.25f / __instance.eid.totalSpeedModifier; } else { __instance.predictAmount = -0.25f / __instance.eid.totalSpeedModifier; } __instance.shootCooldown = ((__instance.difficulty > 2) ? Random.Range(1f, 2f) : 2f); __instance.altShootCooldown = 5f; if (__instance.secondEncounter && num >= 8f && !__instance.enraged && Random.Range(0f, 1f) < 0.5f) { __instance.SwitchWeapon(0); __instance.coinsToThrow = ((__instance.difficulty < 2) ? 1 : 3); __instance.ThrowCoins(); return false; } __instance.chargingAlt = true; ((Component)__instance.weapons[__instance.currentWeapon].transform.GetChild(0)).SendMessage("PrepareAltFire", (SendMessageOptions)1); float num2 = 1f; switch (__instance.difficulty) { case 0: num2 = 1.5f; break; case 1: num2 = 1.25f; break; case 2: case 3: case 4: case 5: num2 = 1f; break; case 19: num2 = 0.8f; break; } ((MonoBehaviour)__instance).Invoke("AltShootWeapon", num2 / __instance.eid.totalSpeedModifier); } else { if (__instance.currentWeapon == 0) { __instance.predictAmount = 0f; } else if (__instance.currentWeapon == 1 || __instance.difficulty > 2) { __instance.predictAmount = 0.15f / __instance.eid.totalSpeedModifier; } else { __instance.predictAmount = -0.25f / __instance.eid.totalSpeedModifier; } if (__instance.currentWeapon == 0 && __instance.distancePatience >= 4f) { __instance.shootCooldown = 1f; } else { __instance.shootCooldown = ((__instance.difficulty > 2) ? Random.Range(1.5f, 2f) : 2f); } ((Component)__instance.weapons[__instance.currentWeapon].transform.GetChild(0)).SendMessage("PrepareFire", (SendMessageOptions)1); if (__instance.currentWeapon == 0) { __instance.shootingForCoin = false; __instance.Flash(); if (__instance.difficulty >= 2) { ((MonoBehaviour)__instance).Invoke("ShootWeapon", 0.75f / __instance.eid.totalSpeedModifier); } if (__instance.difficulty >= 1) { ((MonoBehaviour)__instance).Invoke("ShootWeapon", 0.95f / __instance.eid.totalSpeedModifier); } ((MonoBehaviour)__instance).Invoke("ShootWeapon", 1.15f / __instance.eid.totalSpeedModifier); return false; } float num3 = 1f; switch (__instance.difficulty) { case 0: num3 = 1.25f; break; case 1: num3 = 1f; break; case 2: case 3: case 4: case 5: num3 = 0.75f; break; case 19: num3 = 0.6f; break; } ((MonoBehaviour)__instance).Invoke("ShootWeapon", num3 / __instance.eid.totalSpeedModifier); } return false; } } internal class BillionExplosionController : MonoBehaviour { public float maxSizeMultiplier = 1f; public float speedMultiplier = 1f; public float enemyDamageMultiplier = 1f; public int damage = -1; public float damageMultiplier = 1f; public void Start() { maxSizeMultiplier = 1f; speedMultiplier = 1f; enemyDamageMultiplier = 1f; damage = -1; damageMultiplier = 1f; } } public class StrayAttack : MonoBehaviour { public int projectilesLeft = 0; private Animator anim; private EnemyIdentifier eid; public void Start() { anim = ((Component)this).GetComponent<Animator>(); eid = ((Component)this).GetComponent<EnemyIdentifier>(); } public void Update() { if (!Object.op_Implicit((Object)(object)eid) || eid.dead || !Object.op_Implicit((Object)(object)anim)) { Object.Destroy((Object)(object)this); return; } if (projectilesLeft > 0 && Object.op_Implicit((Object)(object)eid.zombie) && eid.zombie.grounded) { anim.speed = 4f; } else if (Object.op_Implicit((Object)(object)eid.zombie) && !eid.zombie.grounded) { projectilesLeft = 0; } if (projectilesLeft == 0) { anim.speed = 2f; } } } internal class StreetcleanerAfterburn : MonoBehaviour { public int damage = 0; public int tickCount = 4; public float cooldownMax = 0.5f; public float cooldown = 0f; public bool damagedThePlayer = false; public bool stoppedAttacking = false; public bool destroyOnEnd = false; public int ticks = 0; public void Update() { if (!damagedThePlayer || !stoppedAttacking) { return; } cooldown += Time.deltaTime; if (!(cooldown < cooldownMax)) { cooldown = 0f; if (ticks < tickCount) { MonoSingleton<NewMovement>.Instance.GetHurt(damage, false, 0f, false, false, 0.35f, false); ticks++; } else if (destroyOnEnd) { Object.Destroy((Object)(object)this); } else { ticks = 0; damagedThePlayer = false; stoppedAttacking = false; } } } } internal class StalkerHealBackMessenger : MonoBehaviour { public Enemy source; public void Awake() { source = null; } public void HealSelf() { Enemy obj = source; obj.health += 1.5f; EnemyIdentifier eid = source.eid; eid.health += 1.5f; } } internal class StalkerHealBack : MonoBehaviour { public Enemy source; public bool healed = false; public void Update() { if ((Object)(object)source != (Object)null && !healed) { Enemy obj = source; obj.health += 1.5f; EnemyIdentifier eid = source.eid; eid.health += 1.5f; healed = true; } } } internal class SentryMortar : MonoBehaviour { public bool canShootOrb = true; public Rigidbody rb; public void FixedUpdate() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rb != (Object)null) { rb.AddForce(0f, -5f * Mathf.Abs(rb.velocity.y), 0f); } } } public class DamageOverTimeTracker : MonoBehaviour { public class DamageEvent { public float timestamp; public float amount; } public float damageThreshold = 30f; public float timeWindow = 5f; public float cooldownMax = 1f; public bool buffSpeed = true; public bool buffingSpeed = false; public float speedBuff = 1.25f; public float speedBuffTime = 5f; public float speedCooldown = 0f; public bool reached = false; public bool onCooldown = false; public List<DamageEvent> damageEvents = new List<DamageEvent>(); public float previousHealth; public Enemy mach; public float cooldown = 0f; public void Start() { mach = ((Component)this).GetComponent<Enemy>(); previousHealth = mach.health; } public void Update() { if (buffingSpeed) { speedCooldown += Time.deltaTime; if (speedCooldown >= speedBuffTime) { buffingSpeed = false; } } if (onCooldown) { cooldown += Time.deltaTime; if (cooldown < cooldownMax) { return; } reached = false; onCooldown = false; cooldown = 0f; damageEvents.Clear(); } float health = mach.health; float num = previousHealth - health; if (num > 0f) { RegisterDamage(num); } previousHealth = health; } public void RegisterDamage(float damage) { float currentTime = Time.time; damageEvents.Add(new DamageEvent { timestamp = currentTime, amount = damage }); damageEvents.RemoveAll((DamageEvent e) => currentTime - e.timestamp > timeWindow); float num = 0f; foreach (DamageEvent damageEvent in damageEvents) { num += damageEvent.amount; } if (num >= damageThreshold) { OnDamageThresholdReached(); damageEvents.Clear(); } } public void OnDamageThresholdReached() { reached = true; onCooldown = false; if (buffSpeed) { buffingSpeed = true; } } } internal class FerrymanStuff : MonoBehaviour { public float initialSpeed = 0f; public float maxSpeed = 0f; public float speedChangeMultiplier = 1f; public bool reset = false; public bool changeColor = true; public Color targetColor; public Color targetFerrymanCloakColor; public bool reached = false; public bool addedStyle = false; public float currentValue; public float time = 0f; public GameObject obj; public EnemyIdentifier eid; public Material colorMaterial; public Material ferrymanCloakColorMaterial; public Color initialColor; public Color initialFerrymanCloakColor; public void Start() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) currentValue = initialSpeed; obj = ((Component)this).gameObject; _ = targetColor; if (true) { colorMaterial = ((Renderer)obj.GetComponentInChildren<SkinnedMeshRenderer>()).materials[0]; initialColor = colorMaterial.color; } _ = targetFerrymanCloakColor; if (true) { ferrymanCloakColorMaterial = ((Renderer)obj.GetComponentInChildren<SkinnedMeshRenderer>()).materials[1]; initialFerrymanCloakColor = ferrymanCloakColorMaterial.color; } } public void Update() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (currentValue != maxSpeed) { time += Time.deltaTime; } currentValue = Mathf.MoveTowards(currentValue, maxSpeed, speedChangeMultiplier * Time.deltaTime * maxSpeed); if (changeColor) { _ = targetColor; if ((Object)(object)eid != (Object)null && !eid.dead) { colorMaterial.color = Color.Lerp(initialColor, targetColor, (currentValue - initialSpeed) / (maxSpeed - initialSpeed)); } } if (changeColor) { _ = targetFerrymanCloakColor; if ((Object)(object)eid != (Object)null && !eid.dead) { ferrymanCloakColorMaterial.color = Color.Lerp(initialFerrymanCloakColor, targetFerrymanCloakColor, (currentValue - initialSpeed) / (maxSpeed - initialSpeed)); } } if (!(currentValue < maxSpeed)) { if (!addedStyle) { reached = true; } if (reset) { currentValue = 0f; } } } } public class MoveBacker : MonoBehaviour { [CompilerGenerated] private sealed class <MoveBack>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MoveBacker <>4__this; private Vector3 <target>5__1; private Vector3 <forward>5__2; private Vector3 <targetPosition>5__3; private NavMeshHit <hit>5__4; private LayerMask <groundLayer>5__5; private float <navMeshSampleRadius>5__6; private float <groundCheckDistance>5__7; private Vector3 <rayOrigin>5__8; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MoveBack>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.moving = true; if (!Object.op_Implicit((Object)(object)<>4__this.eid) || <>4__this.eid.dead) { return false; } <target>5__1 = ((<>4__this.eid.target == null) ? ((Component)MonoSingleton<NewMovement>.Instance).transform.position : <>4__this.eid.target.position); <forward>5__2 = <target>5__1 - ((Component)<>4__this).transform.position; <forward>5__2.y = 0f; ((Vector3)(ref <forward>5__2)).Normalize(); <targetPosition>5__3 = ((Component)<>4__this).transform.position - 15f * <forward>5__2; <groundLayer>5__5 = LayerMask.op_Implicit(LayerMask.GetMask(new string[4] { "Outdoors", "OutdoorsBaked", "Environment", "EnvironmentBaked" })); <navMeshSampleRadius>5__6 = 1f; <groundCheckDistance>5__7 = 2f; if (!NavMesh.SamplePosition(<targetPosition>5__3, ref <hit>5__4, <navMeshSampleRadius>5__6, -1)) { <>4__this.moving = false; return false; } <rayOrigin>5__8 = ((NavMeshHit)(ref <hit>5__4)).position + ((Component)<>4__this).transform.up * 0.1f; if (!Physics.Raycast(<rayOrigin>5__8, -1f * ((Component)<>4__this).transform.up, <groundCheckDistance>5__7, LayerMask.op_Implicit(<groundLayer>5__5))) { <>4__this.moving = false; return false; } if (!Object.op_Implicit((Object)(object)<>4__this.nma)) { <>4__this.moving = false; return false; } ((Behaviour)<>4__this.nma).enabled = false; <>4__this.rb.isKinematic = false; <>4__this.rb.useGravity = true; <>4__this.rb.drag = 12f; <>4__this.rb.AddForce(-<forward>5__2 * <>4__this.strength, (ForceMode)2); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.rb.isKinematic = true; <>4__this.rb.useGravity = false; if (!Object.op_Implicit((Object)(object)<>4__this.nma)) { <>4__this.moving = false; return false; } ((Behaviour)<>4__this.nma).enabled = true; <>4__this.rb.drag = 0f; <>4__this.nma.Warp(<>4__this.rb.position); <>4__this.moving = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Rigidbody rb; private NavMeshAgent nma; private EnemyIdentifier eid; private float strength = 150f; public bool moving = false; public void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); nma = ((Component)this).GetComponent<NavMeshAgent>(); eid = ((Component)this).GetComponent<EnemyIdentifier>(); } public void Update() { if (eid.dead) { Object.Destroy((Object)(object)this); } } [IteratorStateMachine(typeof(<MoveBack>d__7))] public IEnumerator MoveBack() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MoveBack>d__7(0) { <>4__this = this }; } } internal class CounterInt : MonoBehaviour { public int maxValue; public bool randomized = false; public int randomMin; public int randomMax; public int value = 1; public void Start() { TryRandomize(); } public void Add() { if (value < maxValue) { value++; return; } value = 1; TryRandomize(); } public void TryRandomize() { if (randomized) { maxValue = Random.Range(randomMin, randomMax + 1); } } } internal class TimerFloat : MonoBehaviour { public float target = 1f; public bool deleteOnReached = false; public bool running = false; public bool keepRunning = false; public bool reached = false; public float cooldownMax = 1f; public float cooldown = 0f; public void Start() { cooldownMax = target; } public void Update() { if (reached && deleteOnReached) { Object.Destroy((Object)(object)this); } else { if (!running) { return; } cooldown += Time.deltaTime; if (!(cooldown < cooldownMax)) { reached = true; if (!keepRunning) { running = false; } } } } public void Run() { running = true; } public void Reset() { cooldown = 0f; reached = false; } public void ResetAndRun() { Reset(); Run(); } public void Stop() { running = false; } public void ResetAndStop() { Reset(); Stop(); } } public class BoolValue : MonoBehaviour { public bool value = false; public string description; public static bool? Get(string target, GameObject obj) { BoolValue[] components = obj.GetComponents<BoolValue>(); foreach (BoolValue boolValue in components) { if (boolValue.description == target) { return boolValue.value; } } return null; } public static void Set(string target, bool newValue, GameObject obj) { BoolValue[] components = obj.GetComponents<BoolValue>(); foreach (BoolValue boolValue in components) { if (boolValue.description == target) { boolValue.value = newValue; } } } } internal class EnemyIdentifierSaver : MonoBehaviour { public EnemyIdentifier eid = null; } internal class IdolHealingSetup : MonoBehaviour { public EnemyIdentifier eid; public float cooldownMax = 2f; public float cooldown = 0f; public bool stop = false; public void Start() { eid = ((Component)this).GetComponent<EnemyIdentifier>(); cooldown = cooldownMax; } public void Update() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) if (stop || BlindEnemies.Blind) { return; } cooldown += Time.deltaTime; if (!(cooldown < cooldownMax)) { cooldown = 0f; GameObject val = Object.Instantiate<GameObject>(Plugin.Explosion, ((Component)eid).transform.position, ((Component)eid).transform.rotation); ((Object)val).name = "Idol Healing Explosion"; Transform transform = val.transform; transform.localScale *= 2.5f; Object.Destroy((Object)(object)((Component)val.transform.Find("Sphere_8 (1)")).gameObject); Explosion componentInChildren = val.GetComponentInChildren<Explosion>(); componentInChildren.harmless = true; componentInChildren.damage = 0; componentInChildren.speed = 1.75f; componentInChildren.maxSize = 2.5f; componentInChildren.ignite = false; val.GetComponent<ExplosionController>().tryIgniteGasoline = false; MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val2 in array) { Color color = ((Renderer)val2).material.color; ((Renderer)val2).material.color = new Color(0f, 1f, 0f); } ((Component)componentInChildren).gameObject.AddComponent<EnemyIdentifierSaver>().eid = eid; ((Behaviour)val.GetComponentInChildren<AudioSource>()).enabled = false; RemoveOnTime[] componentsInChildren2 = val.GetComponentsInChildren<RemoveOnTime>(); foreach (RemoveOnTime val3 in componentsInChildren2) { val3.time /= 3f; } ((Component)componentInChildren).GetComponent<Rigidbody>().isKinematic = false; ((Collider)((Component)componentInChildren).GetComponent<SphereCollider>()).isTrigger = true; } } } [HarmonyPatch(typeof(Explosion), "Start")] public class ExplosionIdolPatch { public static void Postfix(ref Explosion __instance) { if (!Util.IsDifficulty(19) || ((Object)((Component)__instance).transform.parent).name != "Idol Healing Explosion") { return; } IdolHealingExplosion idolHealingExplosion = ((Component)__instance).gameObject.AddComponent<IdolHealingExplosion>(); EnemyIdentifierSaver component = ((Component)__instance).gameObject.GetComponent<EnemyIdentifierSaver>(); idolHealingExplosion.healing = 0.8f; EnemyIdentifier[] array = Object.FindObjectsByType<EnemyIdentifier>((FindObjectsSortMode)0); EnemyIdentifier[] array2 = array; foreach (EnemyIdentifier val in array2) { if ((Object)(object)val.idol != (Object)null && (Object)(object)val.idol.target == (Object)(object)component.eid) { ((Component)component.eid).GetComponent<IdolHealingSetup>().cooldownMax = 2f / val.totalHealthModifier; } } } } internal class IdolHealingExplosion : MonoBehaviour { public float healing; public List<EnemyIdentifier> healedList = new List<EnemyIdentifier>(); private void Update() { ((Collider)((Component)this).GetComponent<SphereCollider>()).enabled = true; } private void OnTriggerEnter(Collider other) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Invalid comparison between Unknown and I4 //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Invalid comparison between Unknown and I4 //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Invalid comparison between Unknown and I4 //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected I4, but got Unknown GameObject gameObject = ((Component)other).gameObject; if (gameObject.layer != 10 && gameObject.layer != 11) { return; } EnemyIdentifierIdentifier component = ((Component)other).GetComponent<EnemyIdentifierIdentifier>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.eid) || component.eid.dead) { return; } EnemyIdentifier eid = component.eid; if (healedList.Contains(eid)) { return; } if ((int)eid.enemyType == 1 || (int)eid.enemyType == 9 || (int)eid.enemyType == 38) { if (!Object.op_Implicit((Object)(object)eid.drone)) { eid.drone = ((Component)eid).GetComponent<Drone>(); } if (Object.op_Implicit((Object)(object)eid.drone) && Object.op_Implicit((Object)(object)eid.drone.Enemy)) { float health = 0.1f * (float)Mathf.RoundToInt(10f * (eid.drone.Enemy.health + healing)); eid.drone.Enemy.health = health; eid.health = health; healedList.Add(eid); } return; } if ((int)eid.enemyType == 4) { if (!Object.op_Implicit((Object)(object)eid.spider)) { eid.spider = ((Component)eid).GetComponent<MaliciousFace>(); } if (Object.op_Implicit((Object)(object)eid.spider)) { float health2 = 0.1f * (float)Mathf.RoundToInt(10f * (eid.spider.spider.health + healing)); eid.spider.spider.health = health2; eid.health = health2; healedList.Add(eid); } return; } EnemyClass enemyClass = eid.enemyClass; EnemyClass val = enemyClass; switch ((int)val) { case 0: if (!Object.op_Implicit((Object)(object)eid.zombie)) { eid.zombie = ((Component)eid).GetComponent<Enemy>(); } if (Object.op_Implicit((Object)(object)eid.zombie)) { float health5 = 0.1f * (float)Mathf.RoundToInt(10f * (eid.zombie.health + healing)); eid.zombie.health = health5; eid.health = health5; healedList.Add(eid); } break; case 1: if (!Object.op_Implicit((Object)(object)eid.machine)) { eid.machine = ((Component)eid).GetComponent<Enemy>(); } if (Object.op_Implicit((Object)(object)eid.machine)) { float health4 = 0.1f * (float)Mathf.RoundToInt(10f * (eid.machine.health + healing)); eid.machine.health = health4; eid.health = health4; healedList.Add(eid); } break; case 2: if (!Object.op_Implicit((Object)(object)eid.statue)) { eid.statue = ((Component)eid).GetComponent<Enemy>(); } if (Object.op_Implicit((Object)(object)eid.statue)) { float health3 = 0.1f * (float)Mathf.RoundToInt(10f * (eid.statue.health + healing)); eid.statue.health = health3; eid.health = health3; healedList.Add(eid); } break; } } } public class SlowDownOverTimeEase : MonoBehaviour { public float slowRate; public float rateEase; public bool makeUnparryableOnStop = false; public bool changeColorOnStop = false; public bool hasBeam = false; public float volumeMultiplier = 1f; public Color newProjectileColor; public float cooldownMax = 0.01f; public float cooldown = 0f; public bool stop = false; public Projectile proj; public LineRenderer line; public void Start() { proj = ((Component)this).GetComponent<Projectile>(); line = ((Component)proj).GetComponentInChildren<LineRenderer>(); } public void Update() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (proj.parried) { return; } if ((Object)(object)line == (Object)null) { hasBeam = false; } if (stop) { return; } cooldown += Time.deltaTime; if (cooldown < cooldownMax) { return; } cooldown = 0f; if (proj.speed > 0f) { Projectile obj = proj; obj.speed -= slowRate; slowRate += rateEase; return; } proj.speed = 0.001f; stop = true; if (makeUnparryableOnStop) { proj.unparryable = true; } if (changeColorOnStop) { MeshRenderer[] componentsInChildren = ((Component)proj).GetComponentsInChildren<MeshRenderer>(); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { ((Renderer)val).material.color = newProjectileColor; } if (hasBeam) { line.startColor = newProjectileColor; line.endColor = newProjectileColor; } Light component = ((Component)proj).GetComponent<Light>(); if ((Object)(object)component != (Object)null) { component.color = newProjectileColor; } } if (volumeMultiplier != 1f) { AudioSource[] componentsInChildren2 = ((Component)proj).GetComponentsInChildren<AudioSource>(); foreach (AudioSource val2 in componentsInChildren2) { val2.volume *= volumeMultiplier; } } slowRate += rateEase; } } public class SlowDownOverTime : MonoBehaviour { public float slowRate; public float cooldownMax = 0.01f; public float cooldown = 0f; public bool stop = false; public Projectile proj; public void Start() { proj = ((Component)this).GetComponent<Projectile>(); } public void Update() { if (proj.parried || stop) { return; } cooldown += Time.deltaTime; if (!(cooldown < cooldownMax)) { cooldown = 0f; if (proj.speed > 0f) { Projectile obj = proj; obj.speed -= slowRate; } else { proj.speed = 0.001f; stop = true; } } } } public class ProjectileSpeedStutter : MonoBehaviour { public float cooldownMax = 0.01f; public float cooldown = 0f; public float targetSpeedMultiplier; public float slowRate; public bool homing = false; public bool explodeWhenClose = false; public float explodeDistance; public int explodeStutterDelay; public int explodeStutterCounter = -2; public bool changeColor = false; public AudioSource audio = null; public Projectile proj; public float originalSpeed; public void Start() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) proj = ((Component)this).GetComponent<Projectile>(); originalSpeed = proj.speed; if (homing) { proj.homingType = (HomingType)4; } if (changeColor) { MeshRenderer[] componentsInChildren = ((Component)proj).GetComponentsInChildren<MeshRenderer>(); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { ((Renderer)val).material.color = new Color(1f, 1f, 1f); ((Renderer)val).material.render