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 Configgy;
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("2.1.1.0")]
[assembly: AssemblyInformationalVersion("2.1.1+fb660c27184355245c5aadd8dd1e4239dc6cf11f")]
[assembly: AssemblyProduct("Billion Difficulty")]
[assembly: AssemblyTitle("BillionDifficulty")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.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 bool IsHardMode()
{
return ((ConfigValueElement<bool>)(object)Plugin.IsBrilliantBillion).Value && IsDifficulty(19);
}
public static T[] AddToArray<T>(ref T[] array, T element, int index = -1)
{
if (index == -1)
{
index = array.Length;
}
List<T> list = array.ToList();
list.Insert(index, element);
array = list.ToArray();
return array;
}
public static T[] AddToArray<T>(ref T[] array, T[] elements, int index = -1)
{
if (index == -1)
{
index = array.Length;
}
int num = 0;
int num2 = index;
List<T> list = array.ToList();
while (num < elements.Length)
{
list.Insert(num2, elements[num]);
num++;
num2++;
}
array = list.ToArray();
return array;
}
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", "2.1.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("ULTRAKILL.exe")]
public class Plugin : BaseUnityPlugin
{
private ConfigBuilder config;
[Configgable("", "Brilliant Billion mode", 0, "A very difficult mode intended to make the main campaign a lot harder (doesn't properly update enemies that are already spawned)")]
public static ConfigToggle IsBrilliantBillion = new ConfigToggle(false);
public static bool StayedOnHardMode = false;
public const int BlueFilthRarity = 250;
private static readonly Harmony Harmony = new Harmony("billy.billiondifficulty");
internal static ManualLogSource Logger;
private 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 Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>
{
["ProjectileExplosiveHH"] = null,
["ProjectileHoming"] = null,
["Projectile"] = null,
["GasolineProjectile"] = null,
["ExplosionSuper"] = null,
["Explosion"] = null,
["PumpChargeSound"] = null,
["MirrorReaperGroundWave"] = null,
["ProjectileHomingAcid"] = null,
["ProjectileHomingExplosive"] = null,
["ProjectileMinosPrimeSnake"] = null,
["ExplosionSisyphusPrimeCharged"] = null,
["BlackHoleEnemy"] = null,
["VirtueInsignia"] = null,
["GeryonForwardArrowBeam"] = null,
["PhysicalShockwave"] = null,
["GoopLarge"] = null,
["GoopLargeLong"] = null
};
public static AudioClip PumpCharge = null;
public void Awake()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Harmony.PatchAll();
Logger.LogInfo((object)"Plugin BillionDifficulty is loaded! WOAHHHH");
SceneManager.activeSceneChanged += SceneManagerActiveSceneChanged;
GetAssets();
config = new ConfigBuilder("billy.billiondifficulty", "Billion Difficulty");
ConfigToggle isBrilliantBillion = IsBrilliantBillion;
((ConfigValueElement<bool>)(object)isBrilliantBillion).OnValueChanged = (Action<bool>)Delegate.Combine(((ConfigValueElement<bool>)(object)isBrilliantBillion).OnValueChanged, new Action<bool>(HardModeValueChanged));
config.BuildAll();
}
public void SceneManagerActiveSceneChanged(Scene arg0, Scene arg1)
{
if (SceneHelper.CurrentScene == "Main Menu")
{
AddDifficultyButton();
}
StayedOnHardMode = Util.IsHardMode();
}
public static void HardModeValueChanged(bool v)
{
string text = (v ? "BRILLIANT BILLION" : "BILLION");
StayedOnHardMode = false;
if (SceneHelper.CurrentScene != "Main Menu")
{
text = "BILLION";
}
DifficultyTitle[] array = Object.FindObjectsByType<DifficultyTitle>((FindObjectsSortMode)0);
foreach (DifficultyTitle val in array)
{
val.Check();
}
PresenceController val2 = Object.FindAnyObjectByType<PresenceController>();
if ((Object)(object)val2 != (Object)null && val2.diffNames.Length >= 20 && !(text == val2.diffNames[19]))
{
val2.diffNames[19] = text;
DiscordController val3 = Object.FindAnyObjectByType<DiscordController>();
if (val3 != null)
{
val3.FetchSceneActivity(SceneHelper.CurrentScene);
}
SteamController val4 = Object.FindAnyObjectByType<SteamController>();
if (val4 != null)
{
val4.FetchSceneActivity(SceneHelper.CurrentScene);
}
}
}
public static 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 static void GetAssets()
{
if (!loadedAssets)
{
Prefabs["ProjectileExplosiveHH"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile Explosive HH.prefab");
Prefabs["ProjectileHoming"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile Homing.prefab");
Prefabs["Projectile"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile.prefab");
Prefabs["GasolineProjectile"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/GasolineProjectile.prefab");
Prefabs["ExplosionSuper"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Super.prefab");
Prefabs["Explosion"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab");
Prefabs["PumpChargeSound"] = Ass<GameObject>("Assets/Particles/SoundBubbles/PumpChargeSound.prefab");
PumpCharge = Ass<AudioClip>("Assets/Sounds/Weapons/pumpCharge.wav");
Prefabs["MirrorReaperGroundWave"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/MirrorReaperGroundWave.prefab");
Prefabs["ProjectileHomingAcid"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile Homing Acid.prefab");
((Component)Prefabs["ProjectileHomingAcid"].transform.Find("GoopCloud")).gameObject.AddComponent<RemoveOnRespawn>();
((Component)Prefabs["ProjectileHomingAcid"].transform.Find("GoopCloud")).GetComponent<RemoveOnTime>().time = 10f;
Prefabs["ProjectileHomingExplosive"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile Homing Explosive.prefab");
Prefabs["ProjectileMinosPrimeSnake"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Projectile Minos Prime Snake.prefab");
Prefabs["ExplosionSisyphusPrimeCharged"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Sisyphus Prime Charged.prefab");
Prefabs["BlackHoleEnemy"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/Black Hole Enemy.prefab");
Prefabs["VirtueInsignia"] = Ass<GameObject>("Virtue Insignia");
Prefabs["GeryonForwardArrowBeam"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/GeryonForwardArrowBeam.prefab");
Prefabs["PhysicalShockwave"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/PhysicalShockwave.prefab");
Prefabs["GoopLarge"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/GoopLarge.prefab");
Prefabs["GoopLargeLong"] = Ass<GameObject>("Assets/Prefabs/Attacks and Projectiles/GoopLargeLong.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 GameObject CreateVirtueInsignia(float scaleMult, float windUpSpeedMult, float explosionLength, Vector3 targetPosition, Vector3 lookAtPosition, EnemyTarget enemyTarget, Enemy enemy, float totalDamageMult, float lightIntensityMultiplier = 1f)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_0031: 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)
GameObject val = Object.Instantiate<GameObject>(Prefabs["VirtueInsignia"], targetPosition, Quaternion.identity);
val.SetActive(false);
Transform transform = val.transform;
transform.localScale *= scaleMult;
VirtueInsignia component = val.GetComponent<VirtueInsignia>();
component.noTracking = true;
component.target = enemyTarget;
component.parentEnemy = enemy;
component.hadParent = true;
component.windUpSpeedMultiplier = windUpSpeedMult;
component.explosionLength = explosionLength;
component.damage = Mathf.RoundToInt((float)component.damage * totalDamageMult);
Light[] componentsInChildren = val.GetComponentsInChildren<Light>(true);
foreach (Light val2 in componentsInChildren)
{
val2.intensity *= lightIntensityMultiplier;
}
val.transform.LookAt(lookAtPosition);
val.transform.Rotate(-90f, 0f, 180f);
val.SetActive(true);
return val;
}
public static void SetEnemyWeakness(string name, float value, EnemyIdentifier eid)
{
int num = Array.IndexOf(eid.weaknesses, name);
if (num != -1)
{
eid.weaknessMultipliers[num] = value;
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BillionDifficulty";
public const string PLUGIN_NAME = "Billion Difficulty";
public const string PLUGIN_VERSION = "2.1.1";
}
}
namespace BillionDifficulty.SetupPatches
{
[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 void Postfix(int lvl, ref string __result)
{
if (Util.IsDifficulty(19))
{
string[] array = Path.GetFileName(__result).Split(".");
if (array.Length != 0 && !__result.Contains("difficulty19"))
{
array[0] = "difficulty19" + array[0];
__result = Path.Join(Path.GetDirectoryName(__result).AsSpan(), string.Join(".", array).AsSpan());
}
}
}
}
[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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_006d: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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;
}
}
[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;
}
bool flag = Util.IsHardMode() && (Plugin.StayedOnHardMode || SceneHelper.CurrentScene == "Main Menu");
bool flag2 = Util.IsHardMode() && !Plugin.StayedOnHardMode;
string text = "BILLION";
if (flag)
{
text = "BRILLIANT BILLION";
}
else if (flag2)
{
text = "BILLION*";
}
__instance.txt2.text = (__instance.lines ? ("-- " + text + " --") : text);
FinalRank[] array = Object.FindObjectsByType<FinalRank>((FindObjectsSortMode)0);
if (array == null || array.Length == 0)
{
return;
}
FinalRank val = array[0];
Transform val2 = ((Component)val).transform.Find("Title");
string text2 = ((TMP_Text)((Component)val2.Find("Text")).GetComponent<TextMeshProUGUI>()).text;
string arg;
if (text2.StartsWith("8-4:"))
{
arg = "ffaaaa";
}
else if (text2.StartsWith("P-1:"))
{
arg = "aaffff";
}
else if (text2.StartsWith("P-2:"))
{
arg = "ffccaa";
}
else if (text2.StartsWith("0-E:"))
{
arg = "aaccff";
}
else if (text2.StartsWith("1-E:"))
{
arg = "aaaaaa";
}
else if (text2.StartsWith("2-E:"))
{
arg = "ffbb99";
}
else if (text2.StartsWith("3-E:"))
{
arg = "ccffaa";
}
else
{
if (!text2.StartsWith("9-2:") && !text2.StartsWith("P-") && !text2.Contains("-E"))
{
return;
}
arg = "ffffff";
}
string text3 = $"<color=#{arg}>BILLION</color>S MUST HAVE FUN";
if (flag)
{
text3 = $"<color=#{arg}>BRILLIANT</color> BILLION";
}
else if (flag2)
{
text3 = $"<color=#{arg}>BILLION</color>S MUST HAVE FUN*";
}
__instance.txt2.text = (__instance.lines ? ("-- " + text3 + " --") : text3);
}
}
[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()
{
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] = (Util.IsHardMode() ? "BRILLIANT BILLION" : "BILLION");
}
}
}
namespace BillionDifficulty.GenaralPatches
{
[HarmonyPatch(typeof(ZombieMelee), "Start")]
public class BlueFilthPatch
{
public static void Postfix(ZombieMelee __instance)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
if (__instance.difficulty == 19 && (int)__instance.eid.enemyType == 3 && Random.Range(0, 250) == 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).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);
}
}
}
}
[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 : Component
{
T[] array = Object.FindObjectsByType<T>((FindObjectsSortMode)0);
T[] array2 = array;
foreach (T val in array2)
{
Object.Destroy((Object)(object)((Component)((Component)val).transform.root).gameObject);
}
}
}
[HarmonyPatch(typeof(Projectile), "Explode")]
public class ExplosionPatch
{
public static bool Prefix(Projectile __instance)
{
//IL_0048: 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_0087: 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_0096: 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_01f7: Unknown result type (might be due to invalid IL or missing references)
if (!Util.IsDifficulty(19))
{
return true;
}
if (!__instance.active)
{
return false;
}
ShockwaveOnExplode component = ((Component)__instance).GetComponent<ShockwaveOnExplode>();
if ((Object)(object)component != (Object)null)
{
component.SpawnShockwave(((Component)__instance).transform.position);
}
__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 component2 = ((Component)val2).GetComponent<BillionExplosionController>();
if ((Object)(object)component2 != (Object)null)
{
val2.maxSize *= component2.maxSizeMultiplier;
val2.speed *= component2.speedMultiplier;
val2.enemyDamageMultiplier *= component2.enemyDamageMultiplier;
if (component2.damage == -1)
{
val2.damage = Mathf.RoundToInt(component2.damageMultiplier * (float)val2.damage);
}
else
{
val2.damage = component2.damage;
}
}
}
MonoSingleton<StainVoxelManager>.Instance.TryIgniteAt(((Component)__instance).transform.position, 3);
Object.Destroy((Object)(object)((Component)__instance).gameObject);
return false;
}
}
[HarmonyPatch(typeof(StyleCalculator), "AddPoints")]
public class FriendlyFirePatch
{
public static void Prefix(ref int points, string pointName, EnemyIdentifier eid, GameObject sourceWeapon)
{
if (pointName == "ultrakill.friendlyfire" && Util.IsDifficulty(19))
{
points = Mathf.RoundToInt((float)points * 0.2f);
}
}
}
[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;
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(NewMovement), "Respawn")]
public static void RespawnPostfix(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;
}
RemoveOnRespawn[] array3 = Object.FindObjectsByType<RemoveOnRespawn>((FindObjectsSortMode)0);
RemoveOnRespawn[] array4 = array3;
foreach (RemoveOnRespawn removeOnRespawn in array4)
{
Object.Destroy((Object)(object)((Component)removeOnRespawn).gameObject);
}
}
}
}
[HarmonyPatch(typeof(Punch), "ParriedProjectileBeam")]
public class PunchPatch
{
public static bool Prefix(ContinuousBeam beam)
{
if (!Util.IsDifficulty(19))
{
return true;
}
if ((Object)(object)beam == (Object)null)
{
return false;
}
if (beam.enemy)
{
beam.parryMultiplier = 2.5f;
}
beam.enemy = false;
beam.canHitPlayer = false;
return false;
}
}
[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
public class RadiancePatch
{
public static void Postfix(EnemyIdentifier __instance)
{
//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Invalid comparison between Unknown and I4
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Invalid comparison between Unknown and I4
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between Unknown and I4
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Invalid comparison between Unknown and I4
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Invalid comparison between Unknown and I4
if (!Util.IsDifficulty(19))
{
return;
}
EnemyType enemyType = __instance.enemyType;
EnemyType val = enemyType;
if ((int)val <= 19)
{
if ((int)val == 3)
{
if (Util.IsHardMode())
{
__instance.healthBuffModifier = 1.6666666f;
}
return;
}
if ((int)val == 9)
{
goto IL_006d;
}
if ((int)val == 19)
{
goto IL_007a;
}
}
else if ((int)val <= 26)
{
if ((int)val == 20)
{
goto IL_006d;
}
if ((int)val == 26)
{
goto IL_007a;
}
}
else if ((int)val == 38 || (int)val == 40)
{
goto IL_007a;
}
__instance.speedBuffModifier = 1.25f;
return;
IL_006d:
__instance.speedBuffModifier = 1.1f;
return;
IL_007a:
__instance.speedBuffModifier = 1.15f;
}
}
[HarmonyPatch(typeof(EnemyIdentifier), "SpeedBuff", new Type[] { typeof(float) })]
public class RadianceSpeedPatch
{
public static bool Prefix(float modifier, EnemyIdentifier __instance)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_0030: Invalid comparison between Unknown and I4
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Invalid comparison between Unknown and I4
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Invalid comparison between Unknown and I4
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Invalid comparison between Unknown and I4
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Invalid comparison between Unknown and I4
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_0069;
}
if ((int)val != 20)
{
goto IL_0076;
}
}
__instance.speedBuffModifier = 1.1f;
goto IL_0083;
}
if ((int)val == 26 || (int)val == 38 || (int)val == 40)
{
goto IL_0069;
}
goto IL_0076;
IL_0083:
__instance.UpdateBuffs(false, true);
return false;
IL_0076:
__instance.speedBuffModifier = 1.25f;
goto IL_0083;
IL_0069:
__instance.speedBuffModifier = 1.15f;
goto IL_0083;
}
}
[HarmonyPatch(typeof(EnemyIdentifier), "HealthBuff", new Type[] { typeof(float) })]
public class RadianceHealthPatch
{
public static bool Prefix(float modifier, EnemyIdentifier __instance)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Invalid comparison between Unknown and I4
if (!Util.IsHardMode())
{
return true;
}
__instance.healthBuffRequests++;
if ((int)__instance.enemyType == 3)
{
__instance.healthBuffModifier = 1.6666666f;
}
__instance.UpdateBuffs(false, true);
return false;
}
}
[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>");
}
}
}
}
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;
if (Util.IsHardMode())
{
__instance.projectileAmount = 7;
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CancerousRodent), "Update")]
public static void UpdatePostfix(CancerousRodent __instance)
{
if (!Util.IsDifficulty(19))
{
return;
}
if (__instance.coolDown != 0f)
{
if (!Util.IsHardMode())
{
__instance.coolDown -= 1f * Time.deltaTime;
}
else
{
__instance.coolDown -= 2f * Time.deltaTime;
}
}
if (__instance.coolDown < 0f)
{
__instance.coolDown = 0f;
}
}
}
[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)
{
if (!Util.IsHardMode())
{
__instance.difficultySpeedMultiplier *= 1.3f;
}
else
{
__instance.difficultySpeedMultiplier *= 1.5f;
}
}
}
}
[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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_007e: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_00f5: 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_0256: 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;
}
if (Util.IsHardMode())
{
num = 12f;
}
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_0076: 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)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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_00d0: 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)
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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_0074: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: 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)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: 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_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: 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 = ((Util.IsHardMode() && (!Util.IsHardMode() || !__instance.altVersion)) ? __instance.skullDrone : ((__instance.currentDrone % 2 == 0) ? __instance.skullDrone : __instance.fleshDrone));
GameObject val3 = Object.Instantiate<GameObject>(val2, __instance.targeter.transform.position + __instance.targeter.transform.up * (float)(__instance.altVersion ? 50 : 20), __instance.targeter.transform.rotation);
val3.transform.SetParent(((Component)__instance).transform, true);
EnemyIdentifier val4 = default(EnemyIdentifier);
if (val3.TryGetComponent<EnemyIdentifier>(ref val4))
{
val4.dontCountAsKills = true;
val4.damageBuff = __instance.eid.damageBuff;
val4.healthBuff = __instance.eid.healthBuff;
val4.speedBuff = __instance.eid.speedBuff;
}
DroneFlesh item = default(DroneFlesh);
if (val3.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)
{
float num = ((!Util.IsHardMode()) ? 1.15f : 1.35f);
__instance.anim.speed = num * __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_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: 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_01c9: 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_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: 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;
}
if (Util.IsHardMode())
{
num = 0.5f;
}
((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;
}
if (Util.IsHardMode())
{
num = 0.3f;
}
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 (Util.IsHardMode())
{
__instance.anim.speed = 1.45f;
}
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;
if (Util.IsHardMode())
{
__instance.stunTime = 4f;
}
}
}
}
[HarmonyPatch(typeof(LeviathanHead))]
public class LeviathanHeadPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LeviathanHead), "SetSpeed")]
public static void SetSpeedPostfix(LeviathanHead __instance)
{
if (__instance.lcon.difficulty == 19)
{
float num = ((!Util.IsHardMode()) ? 1.6f : 2.1f);
__instance.anim.speed = num * __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;
if (Util.IsHardMode())
{
__result = 2.6f;
}
}
}
}
[HarmonyPatch(typeof(Projectile), "Start")]
public class LeviathanProjectilePatch
{
[HarmonyPrefix]
public static void Prefix(Projectile __instance)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
if (Util.IsHardMode() && (int)__instance.safeEnemyType == 27 && SceneHelper.CurrentScene == "Level 5-4")
{
__instance.enemyDamageMultiplier = 0f;
}
}
}
[HarmonyPatch(typeof(Mandalore))]
public class MandalorePatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(Mandalore), "Update")]
public static void UpdatePostfix(Mandalore __instance)
{
if (Util.IsDifficulty(19))
{
if (!Util.IsHardMode())
{
__instance.cooldown -= 1f * Time.deltaTime;
}
else
{
__instance.cooldown -= 1.5f * Time.deltaTime;
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Mandalore), "Start")]
public static void StartPostfix(Mandalore __instance)
{
__instance.fullAutoProjectile.GetComponentInChildren<Projectile>().enemyDamageMultiplier = 0f;
__instance.fullerAutoProjectile.GetComponentInChildren<Projectile>().enemyDamageMultiplier = 0f;
}
}
[HarmonyPatch(typeof(MinosBoss))]
public class MinosPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(MinosBoss), "SetSpeed")]
public static void SetSpeedPostfix(MinosBoss __instance)
{
if (__instance.difficulty == 19)
{
float num = ((!Util.IsHardMode()) ? 1.6f : 2f);
__instance.anim.speed = num * __instance.eid.totalSpeedModifier;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MinosBoss), "SpawnBlackHole")]
public static void SpawnBlackHolePostfix(MinosBoss __instance)
{
if (__instance.difficulty == 19)
{
float num = ((!Util.IsHardMode()) ? 1.8f : 2.3f);
BlackHoleProjectile currentBlackHole = __instance.currentBlackHole;
currentBlackHole.speed *= num;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MinosBoss), "Update")]
public static bool UpdatePrefix(MinosBoss __instance)
{
//IL_0028: 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)
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)
{
float num = ((!Util.IsHardMode()) ? 1.375f : 1.6f);
__instance.maxSlams = 99;
__instance.originalAnimSpeed = num * __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)
{
float num = ((!Util.IsHardMode()) ? 1.35f : 1.6f);
__instance.anim.speed = num * __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_0029: 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_0057: Unknown result type (might be due to invalid IL or missing references)
if (difficulty != 19)
{
return true;
}
float num = 1.4f;
if (Util.IsHardMode())
{
num = 1.65f;
}
__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;
if (Util.IsHardMode())
{
num = 1.65f;
}
__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 = ((!Util.IsHardMode()) ? 40f : 50f) * __instance.eid.totalSpeedModifier;
__instance.anim.speed = ((!Util.IsHardMode()) ? 1.4f : 1.65f) * __instance.eid.totalSpeedModifier;
}
}
}
[HarmonyPatch(typeof(SisyphusPrime))]
public class SisyphusPrimePatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(SisyphusPrime), "SetSpeed")]
public static void SetSpeedPostfix(SisyphusPrime __instance)
{
if (__instance.difficulty == 19)
{
float num = ((!Util.IsHardMode()) ? 1.35f : 1.5f);
__instance.anim.speed = num * __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 == 19)
{
num = 1.25f;
}
if (Util.IsHardMode())
{
num = 1.45f;
}
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;
}
if (Util.IsHardMode())
{
num2 = 1.4f;
}
__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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Invalid comparison between Unknown and I4
//IL_0129: 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_0102: 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_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: 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)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
if (__instance.difficulty != 19)
{
return true;
}
if (__instance.target == null || !__instance.active || __instance.dodgeLeft > 0f || __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_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: 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_00de: 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_0105: 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;
}
if (Util.IsHardMode())
{
num2 = 0.55f;
}
((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;
}
if (Util.IsHardMode())
{
num3 = 0.4f;
}
((MonoBehaviour)__instance).Invoke("ShootWeapon", num3 / __instance.eid.totalSpeedModifier);
}
return false;
}
}
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 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);
}
}
}
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 FerrymanCirclingProjectiles : MonoBehaviour
{
public float cooldownMax = 0.3f;
public float scaleMultiplier = 3f;
public float projectileSpeed = 80f;
public float angleStep = 30f;
public float angle = 0f;
public bool active = false;
public bool doubled = false;
public float cooldown = 0f;
public GameObject projectile = Plugin.Prefabs["Projectile"];
public EnemyIdentifier eid;
public void Start()
{
eid = ((Component)this).GetComponent<EnemyIdentifier>();
}
public void Update()
{
if ((Object)(object)eid == (Object)null || eid.dead)
{
if (BoolValue.Get("enraged", ((Component)this).gameObject).GetValueOrDefault())
{
BoolValue.Set("enraged", newValue: false, ((Component)this).gameObject);
EnrageEffect componentInChildren = ((Component)this).gameObject.GetComponentInChildren<EnrageEffect>(true);
Object.Destroy((Object)(object)((Component)componentInChildren).gameObject);
}
Object.Destroy((Object)(object)this);
}
else
{
if (!active)
{
return;
}
cooldown += Time.deltaTime;
if (!(cooldown < cooldownMax))
{
cooldown = 0f;
if (angle >= 360f)
{
angle %= 360f;
}
if (!doubled)
{
Shoot(4f);
}
else
{
Shoot(2.5f);
Shoot(5.5f);
}
angle += angleStep;
}
}
}
public void Shoot(float heightOffset)
{
//IL_000d: 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_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: 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_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(projectile, ((Component)this).transform.position + heightOffset * ((Component)this).transform.up, Quaternion.LookRotation(Vector3.forward));
val.transform.Rotate(new Vector3(0f, angle, 0f), (Space)1);
Transform transform = val.transform;
transform.position += 2f * val.transform.forward;
Transform transform2 = val.transform;
transform2.localScale *= scaleMultiplier;
Projectile component = val.GetComponent<Projectile>();
component.unparryable = true;
component.speed = projectileSpeed;
component.ignoreEnvironment = true;
component.safeEnemyType = (EnemyType)26;
component.enemyDamageMultiplier = 0f;
component.damage = 20f;
RemoveOnTime component2 = val.GetComponent<RemoveOnTime>();
component2.time = 1f;
Object.Destroy((Object)(object)((Component)component).GetComponent<MeshRenderer>());
MeshRenderer component3 = ((Component)((Component)component).transform.Find("AlwaysLookAtCamera/ChargeEffect")).GetComponent<MeshRenderer>();
((Renderer)component3).material.color = Color.white;
TrailRenderer component4 = ((Component)component).GetComponent<TrailRenderer>();
component4.startColor = Color.white;
component4.endColor = new Color(0.5f, 1f, 1f);
Light component5 = ((Component)component).GetComponent<Light>();
component5.color = new Color(0f, 0.3886f, 1f);
}
}
internal class FerrymanStuff : MonoBehaviour
{
public float initialSpeed = 0f;
public float maxSpeed = 0f;
public float speedChangeMultiplier = 1f;
public bool changeColor = true;
public Color targetFerrymanColor;
public Color targetCloakColor;
public bool reached = false;
public bool addedStyle = false;
public float currentValue;
public float time = 0f;
public EnemyIdentifier eid;
public Material ferrymanMaterial;
public Material cloakMaterial;
public Color initialFerrymanColor;
public Color initialCloakColor;
public Color enragedColorMultiplier = new Color(1f, 0.25f, 0.25f);
public void Start()
{
//IL_000e: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
currentValue = initialSpeed;
_ = targetFerrymanColor;
if (true)
{
ferrymanMaterial = ((Renderer)((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>()).materials[0];
initialFerrymanColor = ferrymanMaterial.color;
}
_ = targetCloakColor;
if (true)
{
cloakMaterial = ((Renderer)((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>()).materials[1];
initialCloakColor = cloakMaterial.color;
}
}
public void Update()
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00cb: 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_00ea: 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)
//IL_0122: 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_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: 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)
//IL_01e5: 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_0217: Unknown result type (might be due to invalid IL or missing references)
bool valueOrDefault = BoolValue.Get("enraged", ((Component)this).gameObject).GetValueOrDefault();
if (currentValue < maxSpeed)
{
time += Time.deltaTime;
}
currentValue = Mathf.MoveTowards(currentValue, maxSpeed, speedChangeMultiplier * Time.deltaTime * maxSpeed);
if (changeColor)
{
_ = targetFerrymanColor;
if ((Object)(object)eid != (Object)null && !eid.dead)
{
ferrymanMaterial.color = Color.Lerp(initialFerrymanColor, targetFerrymanColor, (currentValue - initialSpeed) / (maxSpeed - initialSpeed));
if (valueOrDefault)
{
ferrymanMaterial.color = new Color(ferrymanMaterial.color.r * enragedColorMultiplier.r, ferrymanMaterial.color.g * enragedColorMultiplier.g, ferrymanMaterial.color.b * enragedColorMultiplier.b);
}
}
}
if (changeColor)
{
_ = targetCloakColor;
if ((Object)(object)eid != (Object)null && !eid.dead)
{
cloakMaterial.color = Color.Lerp(initialCloakColor, targetCloakColor, (currentValue - initialSpeed) / (maxSpeed - initialSpeed));
if (valueOrDefault)
{
cloakMaterial.color = new Color(cloakMaterial.color.r * enragedColorMultiplier.r, cloakMaterial.color.g * enragedColorMultiplier.g, cloakMaterial.color.b * enragedColorMultiplier.b);
}
}
}
if (!(currentValue < maxSpeed) && !addedStyle)
{
reached = true;
}
}
}
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 float cooldownMaxOriginal;
public void Start()
{
eid = ((Component)this).GetComponent<EnemyIdentifier>();
cooldown = cooldownMax;
cooldownMaxOriginal = cooldownMax;
}
public void Update()
{
//IL_0070: 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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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.Prefabs["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;
}
}
}
internal class IdolHealingExplosion : MonoBehaviour
{
public float healing;
public float healingReducedHardMode;
public List<EnemyIdentifier> healedList = new List<EnemyIdentifier>();
public void Update()
{
((Collider)((Component)this).GetComponent<SphereCollider>()).enabled = true;
}
public void OnTriggerEnter(Collider other)
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Invalid comparison between Unknown and I4
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Invalid comparison between Unknown and I4
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Invalid comparison between Unknown and I4
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: 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 num = healing;
if (Util.IsHardMode() && eid.drone.Enemy.health < 8f)
{
num = healingReducedHardMode;
}
float health = 0.1f * (float)Mathf.RoundToInt(10f * (eid.drone.Enemy.health + num));
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 num2 = healing;
if (Util.IsHardMode() && eid.spider.spider.health < 8f)
{
num2 = healingReducedHardMode;
}
float health2 = 0.1f * (float)Mathf.RoundToInt(10f * (eid.spider.spider.health + num2));