Decompiled source of ULTRAV2 v1.0.0

ultrav2.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ultrav2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ba864e6b88ebbf6f61405c5716c96da76be64dac")]
[assembly: AssemblyProduct("ultrav2")]
[assembly: AssemblyTitle("ultrav2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ultrav2
{
	[BepInPlugin("arandomdumbass.ultrakill.ultrav2", "ULTRAV2", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(V2))]
		[HarmonyPatch("Start")]
		public static class V2_FuckYourIntro_Patch
		{
			private static void Prefix(V2 __instance)
			{
				__instance.longIntro = false;
			}
		}

		[HarmonyPatch(typeof(V2))]
		[HarmonyPatch("Flash")]
		public static class V2_NoFlash_Patch
		{
			private static bool Prefix(V2 __instance)
			{
				return false;
			}
		}

		[HarmonyPatch(typeof(EnemyShotgun))]
		[HarmonyPatch("PrepareFire")]
		public static class V2_NoFlash2_Patch
		{
			private static bool Prefix(EnemyShotgun __instance)
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				Traverse val = Traverse.Create((object)__instance);
				if ((Object)(object)((Component)__instance).GetComponentInParent<V2>() != (Object)null)
				{
					return false;
				}
				AudioSourceExtensions.Play(((Component)__instance.shootPoint).GetComponent<AudioSource>(), true);
				Transform transform = Object.Instantiate<GameObject>(__instance.warningFlash, __instance.shootPoint.position, __instance.shootPoint.rotation).transform;
				transform.localScale *= 2f;
				return false;
			}
		}

		[HarmonyPatch(typeof(EnemyNailgun))]
		[HarmonyPatch("PrepareFire")]
		public static class V2_NoFlash3_Patch
		{
			private static bool Prefix(EnemyNailgun __instance)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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)
				__instance.burstAmount = 0;
				if ((Object)(object)((Component)__instance).GetComponentInParent<V2>() != (Object)null)
				{
					return false;
				}
				Transform transform = Object.Instantiate<GameObject>(__instance.flash, __instance.shootPoint.position, __instance.shootPoint.rotation).transform;
				transform.localScale *= 4f;
				return false;
			}
		}

		[HarmonyPatch(typeof(V2))]
		[HarmonyPatch("Start")]
		public static class V2_Start_Patch
		{
			private static void Postfix(V2 __instance)
			{
				Traverse val = Traverse.Create((object)__instance);
				val.Field("shootCooldown").SetValue((object)0f);
				val.Field("altShootCooldown").SetValue((object)0f);
				val.Field("CoinUpdate").GetValue();
			}
		}

		[HarmonyPatch(typeof(V2))]
		[HarmonyPatch("Update")]
		public static class V2_Update_Patch
		{
			private static void Postfix(V2 __instance)
			{
				Traverse val = Traverse.Create((object)__instance);
				val.Field("dodgeCooldown").SetValue((object)0f);
				__instance.airAcceleration = 12f;
				if (Random.Range(0f, 1f) > 0.97f)
				{
					val.Method("SwitchWeapon", new object[1] { Mathf.RoundToInt(Random.Range(1f, 2f)) }).GetValue();
					val.Field("shootCooldown").SetValue((object)0f);
					val.Field("predictAmount").SetValue((object)Random.Range(0f, 1f));
				}
				if (Random.Range(0f, 1f) > 0.99f)
				{
					if (val.Field("sliding").GetValue() != null)
					{
						val.Method("Slide", Array.Empty<object>()).GetValue();
					}
					else
					{
						val.Method("StopSlide", Array.Empty<object>()).GetValue();
					}
				}
				if (Random.Range(0f, 1f) > 0.99f && __instance.gc.onGround)
				{
					val.Method("ChangeDirection", new object[1] { (float)((Random.Range(0f, 1f) > 0.5f) ? 90 : (-90)) }).GetValue();
					val.Method("Jump", Array.Empty<object>()).GetValue();
				}
				val.Method("LookForCoins", Array.Empty<object>()).GetValue();
				val.Method("Move", Array.Empty<object>()).GetValue();
			}
		}

		[HarmonyPatch(typeof(V2))]
		[HarmonyPatch("SetSpeed")]
		public static class V2_Speed_Patch
		{
			private static void Postfix(V2 __instance)
			{
				Traverse val = Traverse.Create((object)__instance);
				__instance.movementSpeed = 7f;
				if (val.Field("enraged").GetValue() != null)
				{
					__instance.movementSpeed *= 2f;
				}
			}
		}

		internal static ManualLogSource Log;

		private int prevHp = 100;

		private void Awake()
		{
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"V5 IS COMING");
		}

		private void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("arandomdumbass.ultrakill.ultrav2").PatchAll();
			Log.LogInfo((object)"woah v2 patcheddd");
		}

		private void Update()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)MonoSingleton<NewMovement>.Instance != (Object)null))
			{
				return;
			}
			int hp = MonoSingleton<NewMovement>.Instance.hp;
			if (hp < prevHp)
			{
				int num = prevHp - hp;
				Collider[] array = Physics.OverlapSphere(((Component)MonoSingleton<NewMovement>.Instance).transform.position, 10f);
				foreach (Collider val in array)
				{
					if (((Component)val).CompareTag("Enemy") && (Object)(object)((Component)val).GetComponent<V2>() != (Object)null)
					{
						((Component)val).GetComponent<Enemy>().health = ((Component)val).GetComponent<Enemy>().health + (float)num * 0.2f;
						if (((Component)val).GetComponent<Enemy>().health > 40f && !((Component)val).GetComponent<V2>().secondEncounter)
						{
							((Component)val).GetComponent<Enemy>().health = 40f;
						}
						if (((Component)val).GetComponent<Enemy>().health > 80f && ((Component)val).GetComponent<V2>().secondEncounter)
						{
							((Component)val).GetComponent<Enemy>().health = 80f;
						}
						prevHp = hp;
					}
				}
			}
			prevHp = hp;
		}
	}
	[HarmonyPatch(typeof(BossHealthBar))]
	[HarmonyPatch("Awake")]
	internal class V2_BossBar_Patch
	{
		private static void Prefix(BossHealthBar __instance)
		{
			if (__instance.bossName == "V2")
			{
				__instance.bossName = "V2 PROTOTYPE";
			}
		}
	}
	[HarmonyPatch(typeof(TextMeshProUGUI))]
	[HarmonyPatch("OnEnable")]
	internal class V2_Text_Patch
	{
		private static void Prefix(TextMeshProUGUI __instance)
		{
			if (((TMP_Text)__instance).text.Contains("V2") && !((TMP_Text)__instance).text.Contains("The V model") && !((TMP_Text)__instance).text.Contains("After its defeat and escape,"))
			{
				((TMP_Text)__instance).text = "V2 PROTOTYPE";
			}
			if (((TMP_Text)__instance).text.Contains("The V model"))
			{
				((TMP_Text)__instance).text = "<color=#FF4343>TYPE:</color> Supreme Machine\n\n<color=#FF4343>DATA:</color>\n\n<color=#FF0000>AN UNFINISHED PROTOTYPE OF THE SECOND, A NEW V MODEL MADE FOR THE NEW PEACE, YET IT TOOK THE FOUNDATION OF THE BEAUTIFUL CREATION OF THE FIRST MODEL. \n\nTHE CALL OF ITS ORIGINAL PURPOSE LINGERED THROUGH IT'S SYSTEMS AND IT REFUSED TO CHANGE, NO MATTER HOW MUCH IT'S ARCHITECTORS TRIED TO TWEAK IT, REVISE, CHANGE IT. NO USE, THE PROJECT WAS ABANDONDED NEVER TO BE USED AGAIN.\n\nU N T I L   I   C A M E .</color> \n\n<color=#FF4343>STRATEGY:</color>\n\n<color=#FF0000>AS A IMPERFECTION IT IS, IT DESIRES TO BE YOU, ACT LIKE YOU, AND LEARN LIKE YOU YET IT CANNOT WITH ITS CURRENT ARSENAL, A FLAW YOU SHALL ABUSE TO YOUR WILL. WHILE IT'S BODY IS LIMITED BUT ENTAILS YOUR ATTENTION. THE PETALS TO YOUR ROSE, YOUR BLOOD ONLY FUELS IT MORE AND MORE DOES IT YEARN. BE AFRAID AND YOU WILL BE PLUNGED INTO A BUFFET OF IT'S CHOICE. WHAT SHOULD YOU DO?\n\nCHASE IT, FACE IT AND HAVE A LITTLE \n\nC O N V E R S A T I O N.</color>\n\nError: v2.bio file data failed to load.";
			}
			if (((TMP_Text)__instance).text.Contains("After its defeat and escape,"))
			{
				((TMP_Text)__instance).text = "<color=#FF4343>TYPE:</color> Supreme Machine\n\n<color=#FF4343>DATA:</color>\n\n<color=#FF0000>HOW COMPELLING YET SO SAD. THE MACHINE INTERALLY COLORED WITH YOU, EXTERNALLY COLORED WITH ITS HATE TRAVELED, AND TRAVELED.\n\nIT ENDED UP FORGING THE WHIPLASH AS A BANDAGE FOR ITSELF AND LIVED ON A PYRAMID, WAITING EACH DAY, MONTH, YEAR FOR ONE THING\n\nYOU.\n\nHOWEVER YOU UNDERSTAND THE FATE OF IT DONT YOU? A FATE WHERE IT COLLAPSED UNDER IT'S OWN ENVIOUS AMBITION FOR YOU\n\nYOU UNDERSTAND YOURSELF, YOU'VE PLAYED YOURSELF, OR WAS THAT NEVER YOU IN THE FIRST PLACE? PERHAPS YOU WOULD AND WANT TO... FIND OUT?\n\nREGARDLESS, IT WAS NEVER ABOUT THEM IT WAS ABOUT\n\nY O U .</color>\n\n<color=#FF4343>STRATEGY:</color>\n\n<color=#FF0000>IT IS NOW BLIND, LOST IT'S SENSE OF WAY. IT HAS LEARNED NOTHING TO ITS OWN CONFLICTED VEXATION. IT TRIES TO MIMIC YOUR ARSENAL AND MAKE USE OF IT, YET ITS STILL BEYOND COMPLETE COMPARED TO YOURS. ITS OWN LIMB THAT'S NOW YOURS MAKES IT MORE IRATE. YOUR OWN REFLECTION CANT REFLECT YOU ANYMORE AND IT HAS BEEN LOST TO TIME. ONCE YOU ARE READY TO INFLICT YOUR OWN UNMATCHED WRATH, GET READY TO CALL YOURSELF THE NEW\n\nS T A R   O F   T H E   S H O W !</color>\n\nError: v2second.bio file data failed to load.";
			}
		}
	}
}