Decompiled source of LethalAmpUp v4.0.2

LethalAmpUp.dll

Decompiled 4 months ago
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalAmpUp.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LethalAmpUp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalAmpUp")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("295e10bc-e4fe-4a3a-8cc1-c352b4c3f427")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalAmpUp
{
	[BepInPlugin("Janimates.LethalAmpUp", "LethalAmpUp", "1.0.0")]
	public class LethalAmpUpBase : BaseUnityPlugin
	{
		private const string modGUID = "Janimates.LethalAmpUp";

		private const string modName = "LethalAmpUp";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Janimates.LethalAmpUp");

		private static LethalAmpUpBase Instance;

		internal ManualLogSource mls;

		public static ConfigEntry<bool> EnableModifiers;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			EnableModifiers = ((BaseUnityPlugin)this).Config.Bind<bool>("LAU Additions", "LAU Modifications", false, "(NOT FINISHED) Adds unique modifiers similar to BrutalCompany!");
			mls = Logger.CreateLogSource("Janimates.LethalAmpUp");
			mls.LogInfo((object)"Amping the mod!");
			harmony.PatchAll(typeof(LethalAmpUpBase));
			harmony.PatchAll(typeof(RadMechAIBPatch));
			harmony.PatchAll(typeof(NutCrackerAIBPatch));
			harmony.PatchAll(typeof(MouthDogAIBPatch));
			harmony.PatchAll(typeof(ButlerAIBPatch));
			harmony.PatchAll(typeof(FlashlightBPatch));
			harmony.PatchAll(typeof(BunkerSpiderAIBPatch));
			harmony.PatchAll(typeof(ClaySurgeonAIBPatch));
			harmony.PatchAll(typeof(GhostGirlAIBPatch));
			harmony.PatchAll(typeof(FlowerManAIBPatch));
			harmony.PatchAll(typeof(EnemyAIBPatch));
			harmony.PatchAll(typeof(SnareFleaAIBPatch));
			harmony.PatchAll(typeof(HoardingBugAIBPatch));
			harmony.PatchAll(typeof(DoubleWingAIBPatch));
			harmony.PatchAll(typeof(ThumperAIBPatch));
			harmony.PatchAll(typeof(StartOfRoundBPatch));
			harmony.PatchAll(typeof(ForestGiantAIBPatch));
		}
	}
}
namespace LethalAmpUp.Patches
{
	[HarmonyPatch(typeof(BlobAI))]
	internal class BlobAIBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void BlobAIAmplify(ref BlobAI __instance)
		{
			((EnemyAI)__instance).enemyType.pushPlayerForce = 5f;
		}
	}
	[HarmonyPatch(typeof(SandSpiderAI))]
	internal class BunkerSpiderAIBPatch
	{
		public static Dictionary<SandSpiderAI, float> SpiderSpeedBoosts = new Dictionary<SandSpiderAI, float>();

		private static readonly float BASE_SPIDER_SPEED = -1.25f;

		private static readonly float MAX_SPIDER_SPEED = 12.5f;

		[HarmonyPatch(typeof(SandSpiderAI), "Start")]
		[HarmonyPostfix]
		private static void SpiderStart(ref SandSpiderAI __instance)
		{
			if (!SpiderSpeedBoosts.ContainsKey(__instance))
			{
				SpiderSpeedBoosts.Add(__instance, BASE_SPIDER_SPEED);
			}
		}

		[HarmonyPatch(typeof(SandSpiderAI), "OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static void SpiderDamagePlayer(ref SandSpiderAI __instance, ref Collider other, ref bool ___onWall, ref bool ___spoolingPlayerBody, ref float ___timeSinceHittingPlayer)
		{
			if (SpiderSpeedBoosts.ContainsKey(__instance) && !(((EnemyAI)__instance).isEnemyDead | ___onWall) && !((Object)(object)((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, ___spoolingPlayerBody, false) == (Object)null) && !(___timeSinceHittingPlayer <= 1f))
			{
				SpiderSpeedBoosts[__instance] += Random.Range(0.5f, 1.5f);
			}
		}

		[HarmonyPatch("OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static bool OnCollideWithPlayer(ref SandSpiderAI __instance, ref Collider other)
		{
			//IL_00a9: 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)
			if (((EnemyAI)__instance).isEnemyDead && Traverse.Create((object)__instance).Field("onWall").GetValue<bool>())
			{
				return false;
			}
			PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, Traverse.Create((object)__instance).Field("SpoolingPlayerBody").GetValue<bool>(), false);
			if ((Object)(object)val != (Object)null && Traverse.Create((object)__instance).Field("timeSinceHittingPlayer").GetValue<float>() > 0.5f)
			{
				Traverse.Create((object)__instance).Field("timeSinceHittingPlayer").SetValue((object)0f);
				val.DamagePlayer(25, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
				__instance.HitPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
			}
			return false;
		}

		[HarmonyPatch(typeof(SandSpiderAI), "StopChasing")]
		[HarmonyPostfix]
		private static void ResetSpeed(ref SandSpiderAI __instance)
		{
			if (SpiderSpeedBoosts.ContainsKey(__instance))
			{
				SpiderSpeedBoosts[__instance] = BASE_SPIDER_SPEED;
			}
		}

		[HarmonyPatch(typeof(SandSpiderAI), "Update")]
		[HarmonyPostfix]
		private static void SpiderUpdate(ref SandSpiderAI __instance)
		{
			if (SpiderSpeedBoosts.ContainsKey(__instance) && ((NetworkBehaviour)__instance).IsOwner && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && SpiderSpeedBoosts[__instance] != 0f)
			{
				((EnemyAI)__instance).agent.speed = Mathf.Clamp(((EnemyAI)__instance).agent.speed + SpiderSpeedBoosts[__instance], 0f, MAX_SPIDER_SPEED);
				__instance.spiderSpeed = Mathf.Clamp(__instance.spiderSpeed + SpiderSpeedBoosts[__instance], 0f, MAX_SPIDER_SPEED);
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void BunkerSpiderAmp(ref SandSpiderAI __instance)
		{
			((EnemyAI)__instance).enemyHP = 6;
		}
	}
	[HarmonyPatch(typeof(ButlerEnemyAI))]
	internal class ButlerAIBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ButlerAmplify(ref ButlerEnemyAI __instance)
		{
			__instance.idleMovementSpeedBase = 10f;
			((EnemyAI)__instance).enemyHP = 10;
			((EnemyAI)__instance).enemyType.MaxCount = 1;
			((EnemyAI)__instance).enemyType.PowerLevel = 3f;
		}

		[HarmonyPatch("OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static bool ButlerCollidePatch(ref ButlerEnemyAI __instance, ref Collider other)
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			if (((EnemyAI)__instance).isEnemyDead)
			{
				return false;
			}
			if (((EnemyAI)__instance).currentBehaviourStateIndex != 2 && Random.Range(0, 100) >= 100)
			{
				return false;
			}
			if (Traverse.Create((object)__instance).Field("timeSinceHittingPlayer").GetValue<float>() < 0.167f)
			{
				return false;
			}
			PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false);
			if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return false;
			}
			Traverse.Create((object)__instance).Field("timeSinceHittingPlayer").SetValue((object)0f);
			if (((EnemyAI)__instance).currentBehaviourStateIndex != 2)
			{
				Traverse.Create((object)__instance).Field("berserkModeTimer").SetValue((object)60f);
			}
			val.DamagePlayer(5, true, true, (CauseOfDeath)14, 0, false, default(Vector3));
			__instance.StabPlayerServerRpc((int)val.playerClientId, true);
			return false;
		}
	}
	[HarmonyPatch(typeof(ClaySurgeonAI))]
	internal class ClaySurgeonAIBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ClaySurgeonAmplify(ref ClaySurgeonAI __instance)
		{
			__instance.jumpSpeed = 7f;
			__instance.jumpTime = 1f;
			__instance.startingInterval = 1.5f;
			__instance.endingInterval = 0.15f;
		}
	}
	[HarmonyPatch(typeof(SpringManAI))]
	internal class CoilHeadAIBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void CoilheadAIAmplify(ref SpringManAI __instance)
		{
			((EnemyAI)__instance).enemyType.MaxCount = 2;
			Traverse.Create((object)__instance).Field("currentChaseSpeed").SetValue((object)5);
		}
	}
	[HarmonyPatch(typeof(DoublewingAI))]
	internal class DoubleWingAIBPatch
	{
		[HarmonyPatch("AlertBird")]
		[HarmonyPrefix]
		private static void DoubleWingExplosive(ref DoublewingAI __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 0f, 10f, 0, 30f, (GameObject)null, false);
		}
	}
	[HarmonyPatch(typeof(BaboonBirdAI))]
	internal class DumbIdiotsAIBPatch
	{
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class EnemyAIBPatch
	{
		[HarmonyPatch(typeof(EnemyAI), "ReachedNodeInSearch")]
		[HarmonyPostfix]
		private static void EnemyReachedNode(ref EnemyAI __instance)
		{
			if (__instance is SandWormAI)
			{
				SandWormReachedNode(((Component)__instance).GetComponent<SandWormAI>());
			}
			else if (__instance is RadMechAI)
			{
				RadMechReachedNode(((Component)__instance).GetComponent<RadMechAI>());
			}
		}

		private static void SandWormReachedNode(SandWormAI worm)
		{
			if (!((Object)(object)worm == (Object)null) && !((EnemyAI)worm).isEnemyDead && StartOfRound.Instance.livingPlayers != 0 && ((EnemyAI)worm).currentBehaviourStateIndex == 0 && !worm.inEmergingState && Random.Range(0, 100) < 97)
			{
				worm.StartEmergeAnimation();
			}
		}

		private static void RadMechReachedNode(RadMechAI mech)
		{
			if (!((Object)(object)mech == (Object)null) && !((EnemyAI)mech).isEnemyDead)
			{
				if (Random.Range(0, 100) >= 90)
				{
					mech.FlickerFace();
					return;
				}
				if (Random.Range(0, 100) >= 95)
				{
					mech.EnableSpotlight();
					return;
				}
				if (Random.Range(0, 100) >= 95)
				{
					mech.EnableBlowtorch();
					return;
				}
				mech.DisableSpotlight();
				mech.DisableBlowtorch();
			}
		}
	}
	[HarmonyPatch(typeof(FlashlightItem))]
	internal class FlashlightBPatch
	{
		private static AudioClip[] sprayCanSFX;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void FlashLightChanges(ref FlashlightItem __instance)
		{
			if (__instance.flashlightTypeID == 1)
			{
				((GrabbableObject)__instance).itemProperties.batteryUsage = 15f;
				((GrabbableObject)__instance).useCooldown = 0.25f;
				((GrabbableObject)__instance).insertedBattery.charge = 0f;
				if (sprayCanSFX == null)
				{
					sprayCanSFX = Resources.FindObjectsOfTypeAll<SprayPaintItem>().First().sprayCanShakeSFX;
				}
			}
		}

		[HarmonyPatch("EquipItem")]
		[HarmonyPostfix]
		private static void EquipFlashlightPatch(ref FlashlightItem __instance)
		{
			if (__instance.flashlightTypeID == 1)
			{
				((GrabbableObject)__instance).insertedBattery.empty = false;
			}
		}

		[HarmonyPatch("ItemActivate")]
		[HarmonyPrefix]
		private static bool ItemActivateChange(ref FlashlightItem __instance)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.flashlightTypeID != 1)
			{
				return true;
			}
			__instance.flashlightAudio.PlayOneShot(sprayCanSFX[Random.Range(0, sprayCanSFX.Length)]);
			((GrabbableObject)__instance).insertedBattery.charge = Mathf.Clamp01(((GrabbableObject)__instance).insertedBattery.charge + 0.12f);
			PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy;
			if (playerHeldBy != null)
			{
				playerHeldBy.playerBodyAnimator.SetBool("Grab", true);
			}
			((GrabbableObject)__instance).insertedBattery.empty = false;
			((GrabbableObject)__instance).SyncBatteryServerRpc((int)(((GrabbableObject)__instance).insertedBattery.charge * 100f));
			__instance.SwitchFlashlight(true);
			RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 22f, 0.6f, 0, ((GrabbableObject)__instance).isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0);
			return false;
		}

		[HarmonyPatch("UseUpBatteries")]
		[HarmonyPostfix]
		private static void UseUpBatteriesPatch(ref FlashlightItem __instance)
		{
			if (__instance.flashlightTypeID == 1)
			{
				((GrabbableObject)__instance).insertedBattery.empty = false;
			}
		}
	}
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowerManAIBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void BrackenAIAmplify(ref FlowermanAI __instance)
		{
			if (!((EnemyAI)__instance).isEnemyDead && !__instance.inKillAnimation && !((Object)(object)GameNetworkManager.Instance == (Object)null) && ((EnemyAI)__instance).currentBehaviourStateIndex == 0)
			{
				((EnemyAI)__instance).agent.speed = 1f;
			}
		}
	}
	[HarmonyPatch(typeof(ForestGiantAI))]
	internal class ForestGiantAIBPatch
	{
		public static List<ForestGiantAI> BlindGiants = new List<ForestGiantAI>();

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void GiantAmplify(ref ForestGiantAI __instance)
		{
			if (Random.Range(0, 100) < 85 && !BlindGiants.Contains(__instance))
			{
				MakeGiantBlind(__instance);
			}
		}

		[HarmonyPatch("LookForPlayers")]
		[HarmonyPrefix]
		private static bool GiantDoesNotSearch(ref ForestGiantAI __instance)
		{
			return !BlindGiants.Contains(__instance);
		}

		[HarmonyPatch(typeof(ForestGiantAI), "Update")]
		[HarmonyPostfix]
		private static void BlindBuff(ref ForestGiantAI __instance)
		{
			if (BlindGiants.Contains(__instance) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f))
			{
				((EnemyAI)__instance).agent.speed = 8.5f;
			}
		}

		private static void MakeGiantBlind(ForestGiantAI giant)
		{
			if (!BlindGiants.Contains(giant))
			{
				ScanNodeProperties componentInChildren = ((Component)giant).GetComponentInChildren<ScanNodeProperties>();
				if (!((Object)(object)componentInChildren == (Object)null))
				{
					BlindGiants.Add(giant);
					componentInChildren.headerText = "Blind Giant";
					componentInChildren.subText = "Fast, But Blind.";
				}
			}
		}

		[HarmonyPatch(typeof(EnemyAI), "SetEnemyStunned")]
		[HarmonyPostfix]
		private static void GiantStunned(ref EnemyAI __instance)
		{
			if (Random.Range(0, 100) < 97)
			{
				ForestGiantAI component = ((Component)__instance).GetComponent<ForestGiantAI>();
				if (!((Object)(object)component == (Object)null) && !BlindGiants.Contains(component))
				{
					MakeGiantBlind(component);
				}
			}
		}
	}
	[HarmonyPatch(typeof(DressGirlAI))]
	internal class GhostGirlAIBPatch
	{
		[HarmonyPatch("ChoosePlayerToHaunt")]
		[HarmonyPostfix]
		private static void GhostGirlHauntAmp(ref DressGirlAI __instance)
		{
			Traverse.Create((object)__instance).Field("timesStared").SetValue((object)999);
			Traverse.Create((object)__instance).Field("timesSeenByPlayer").SetValue((object)5);
			if (Random.Range(0, 100) < 50)
			{
				BreakerBox val = Object.FindObjectOfType<BreakerBox>();
				if (!((Object)(object)val == (Object)null))
				{
					val.SetSwitchesOff();
					RoundManager.Instance.TurnOnAllLights(false);
				}
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void GhostGirlAmp(ref DressGirlAI __instance)
		{
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoardingBugAIBPatch
	{
		[HarmonyPatch(typeof(HoarderBugAI), "Update")]
		[HarmonyPostfix]
		private static void HoarderSpeedPatch(ref HoarderBugAI __instance)
		{
			if (((EnemyAI)__instance).currentBehaviourStateIndex == 1 && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && __instance.heldItem != null)
			{
				((EnemyAI)__instance).agent.speed = 20f;
			}
		}
	}
	[HarmonyPatch(typeof(MouthDogAI))]
	internal class MouthDogAIBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void MouthDogAmplify(ref MouthDogAI __instance)
		{
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void UpdatePatch(ref MouthDogAI __instance)
		{
			if (((NetworkBehaviour)__instance).IsOwner && ((EnemyAI)__instance).currentBehaviourStateIndex == 3 && !(((EnemyAI)__instance).agent.speed > 10f) && !__instance.endingLunge && !Traverse.Create((object)__instance).Field("inKillAnimation").GetValue<bool>())
			{
				__instance.endingLunge = true;
				Traverse.Create((object)__instance).Field("lungeCooldown").SetValue((object)0.15f);
				__instance.EndLungeServerRpc();
			}
		}
	}
	[HarmonyPatch(typeof(NutcrackerEnemyAI))]
	internal class NutCrackerAIBPatch
	{
		public static List<NutcrackerEnemyAI> Alphred = new List<NutcrackerEnemyAI>();

		[HarmonyPatch("TurnTorsoToTargetDegrees")]
		[HarmonyPrefix]
		private static void IncreaseSpeed(ref NutcrackerEnemyAI __instance)
		{
			NutcrackerEnemyAI obj = __instance;
			obj.torsoTurnSpeed *= 3f;
		}

		[HarmonyPatch("TurnTorsoToTargetDegrees")]
		[HarmonyPostfix]
		private static void RevertSpeed(ref NutcrackerEnemyAI __instance)
		{
			NutcrackerEnemyAI obj = __instance;
			obj.torsoTurnSpeed /= 3f;
		}

		[HarmonyPatch("GlobalNutcrackerClock")]
		[HarmonyPrefix]
		private static bool ReplaceClockFunction(ref NutcrackerEnemyAI __instance)
		{
			if (!Traverse.Create((object)__instance).Field("isLeaderScript").GetValue<bool>())
			{
				return false;
			}
			if (Time.realtimeSinceStartup - NutcrackerEnemyAI.timeAtNextInspection <= 2f)
			{
				return false;
			}
			NutcrackerEnemyAI.timeAtNextInspection = Time.realtimeSinceStartup + (float)Random.Range(3, 6);
			return false;
		}

		[HarmonyPatch("ReloadGun")]
		[HarmonyPostfix]
		private static void ReloadDefense(ref NutcrackerEnemyAI __instance)
		{
			//IL_001f: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			if (Random.Range(0, 100) >= 99)
			{
				Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 0f, 15f, 0, 30f, (GameObject)null, false);
				Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 0f, 15f, 5, 30f, (GameObject)null, false);
				Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 0f, 15f, 10, 30f, (GameObject)null, false);
				Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 0f, 15f, 15, 30f, (GameObject)null, false);
				Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 0f, 15f, 20, 30f, (GameObject)null, false);
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void AlphredNut(ref NutcrackerEnemyAI __instance)
		{
			if (Random.Range(0, 100) > 99 && !Alphred.Contains(__instance))
			{
				ScanNodeProperties componentInChildren = ((Component)__instance).GetComponentInChildren<ScanNodeProperties>();
				if (!((Object)(object)componentInChildren == (Object)null))
				{
					Alphred.Add(__instance);
					componentInChildren.headerText = "Alphred";
					componentInChildren.subText = "He's Alphred.";
					((EnemyAI)__instance).enemyHP = 6;
				}
			}
		}
	}
	[HarmonyPatch(typeof(RadMechAI))]
	internal class RadMechAIBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void RadMechAmplify(ref RadMechAI __instance)
		{
			RadMechAI obj = __instance;
			obj.fireRate *= 0.5f;
			RadMechAI obj2 = __instance;
			obj2.missileSpeed *= 3f;
			AISearchRoutine searchForPlayers = __instance.searchForPlayers;
			searchForPlayers.searchWidth /= 1.5f;
			RadMechAI obj3 = __instance;
			obj3.chargeForwardSpeed *= 1.5f;
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ExtraRoundManagerStuff(ref RoundManager __instance)
		{
		}
	}
	[HarmonyPatch(typeof(CentipedeAI))]
	internal class SnareFleaAIBPatch
	{
		[HarmonyPatch("OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static bool CancelCollide()
		{
			return false;
		}

		[HarmonyPatch("fallFromCeiling")]
		[HarmonyPrefix]
		private static bool FleaFallFromCeilingPatch(ref CentipedeAI __instance, ref IEnumerator __result)
		{
			__result = FleaFallFromCeiling(__instance);
			return false;
		}

		private static IEnumerator FleaFallFromCeiling(CentipedeAI flea)
		{
			((EnemyAI)flea).targetNode = null;
			Vector3 start = ((Component)flea).transform.position;
			Vector3 ground = ((Component)flea).transform.position;
			Ray ray = new Ray(((Component)flea).transform.position, Vector3.down);
			RaycastHit hit = default(RaycastHit);
			if (!Physics.Raycast(ray, ref hit, 20f, 268435712))
			{
				start = RoundManager.Instance.GetNavMeshPosition(((Ray)(ref ray)).GetPoint(4f), default(NavMeshHit), 7f, -1);
				if (((NetworkBehaviour)flea).IsOwner)
				{
					((EnemyAI)flea).KillEnemyOnOwnerClient(true);
				}
			}
			else
			{
				ground = ((RaycastHit)(ref hit)).point;
			}
			float fallTime = 0f;
			float fallSpeed = 2.5f;
			while (fallTime < 1f)
			{
				yield return null;
				fallTime += Time.deltaTime * fallSpeed;
				((Component)flea).transform.position = Vector3.Lerp(start, ground, flea.fallToGroundCurve.Evaluate(fallTime));
			}
			((EnemyAI)flea).creatureSFX.PlayOneShot(flea.hitGroundSFX);
			((EnemyAI)flea).serverPosition = ((Component)flea).transform.position;
			if (((NetworkBehaviour)flea).IsOwner)
			{
				((EnemyAI)flea).agent.speed = 0f;
			}
			else
			{
				((Component)flea).transform.eulerAngles = new Vector3(0f, ((Component)flea).transform.eulerAngles.y, 0f);
			}
			Traverse.Create((object)flea).Field("clingingToCeiling").SetValue((object)false);
			((EnemyAI)flea).inSpecialAnimation = false;
			yield return (object)new WaitForSeconds(0.2f);
			Landmine.SpawnExplosion(((Component)flea).transform.position, true, 0f, 3f, 45, 25f, (GameObject)null, false);
			Traverse.Create((object)flea).Field("ceilingAnimationCoroutine").SetValue((object)null);
			Traverse.Create((object)flea).Field("startedCeilingAnimationCoroutine").SetValue((object)false);
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundBPatch
	{
		public static Dictionary<SandSpiderAI, float> SpiderSpeedBoosts = new Dictionary<SandSpiderAI, float>();

		public static List<ForestGiantAI> BlindGiants = new List<ForestGiantAI>();

		public static List<NutcrackerEnemyAI> Alphred = new List<NutcrackerEnemyAI>();

		[HarmonyPatch(typeof(StartOfRound), "StartGame")]
		[HarmonyPrefix]
		private static void StartGamePatch()
		{
			SpiderSpeedBoosts.Clear();
			BlindGiants.Clear();
			Alphred.Clear();
		}
	}
	[HarmonyPatch(typeof(CrawlerAI))]
	internal class ThumperAIBPatch
	{
		[HarmonyPatch("MakeScreech")]
		[HarmonyPrefix]
		private static bool NoMoreScreech(ref CrawlerAI __instance)
		{
			//IL_0010: 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)
			if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)__instance).transform.position) < 15f)
			{
				GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.75f, true);
			}
			return false;
		}

		[HarmonyPatch("OnCollideWithPlayer")]
		[HarmonyPrefix]
		private static bool OnCollideWithPlayerThump(ref CrawlerAI __instance, ref Collider other)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if (!(Traverse.Create((object)__instance).Field("timeSinceHittingPlayer").GetValue<float>() < 0.2f))
			{
				PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					Traverse.Create((object)__instance).Field("timeSinceHittingPlayer").SetValue((object)0);
					val.DamagePlayer(10, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					((EnemyAI)__instance).agent.speed = 0f;
					__instance.HitPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
					GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true);
				}
			}
			return false;
		}

		[HarmonyPatch("EatPlayerBodyAnimation")]
		[HarmonyPrefix]
		private static void ExplodeOnSuccess(ref CrawlerAI __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 0f, 10f, 15, 55f, (GameObject)null, false);
		}
	}
}