Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EliteEnemyVariants v5.0.0
EliteEnemyVariants.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Json; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using MenuLib.Structs; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using UnityEngine.TextCore; using UnityEngine.TextCore.LowLevel; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPOJP")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("5.0.0.102")] [assembly: AssemblyInformationalVersion("5.0.0+build.102")] [assembly: AssemblyProduct("EliteEnemyVariants")] [assembly: AssemblyTitle("EliteEnemyVariants")] [assembly: AssemblyMetadata("BuildNumber", "102")] [assembly: AssemblyVersion("5.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } [CompilerGenerated] [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 REPOJP.EliteEnemyVariants { internal static class AdapterPatchValidator { internal static void Validate(EliteArchetype archetype) { switch (archetype) { case EliteArchetype.Animal: Fields(typeof(EnemyAnimal), "currentState", "stateTimer", "havocTimer", "playerTarget", "agentDestination"); Methods(typeof(EnemyAnimal), "UpdateState"); break; case EliteArchetype.BirthdayBoy: Fields(typeof(EnemyBirthdayBoy), "currentState", "stateTimer", "secondStateTimer", "photonView", "balloons"); Methods(typeof(EnemyBirthdayBoy), "CheckForPoppedBalloons", "UpdatePlayerTarget", "UpdateState"); break; case EliteArchetype.CleanupCrew: Fields(typeof(EnemyBombThrower), "currentState", "stateTimer", "headCooldown", "headAttackCooldown", "meleeCooldown", "playerTarget"); Methods(typeof(EnemyBombThrower), "UpdateState"); break; case EliteArchetype.Bowtie: Fields(typeof(EnemyBowtie), "currentState", "stateTimer", "attacks"); Methods(typeof(EnemyBowtie), "UpdateState"); break; case EliteArchetype.Peeper: Fields(typeof(EnemyCeilingEye), "currentState", "eyeDamageWaitTimer", "eyeDamageTimer", "targetPlayer", "photonView"); Methods(typeof(EnemyCeilingEye), "UpdateState", "TargetPlayerRPC"); break; case EliteArchetype.ApexPredator: Fields(typeof(EnemyDuck), "currentState", "stateTimer", "chaseTimer", "playerTarget"); Methods(typeof(EnemyDuck), "UpdateState"); break; case EliteArchetype.Elsa: Fields(typeof(EnemyElsa), "currentState", "stateTimer", "angryTimer", "chaseTimer", "playerTarget", "photonView"); Methods(typeof(EnemyElsa), "UpdateState", "UpdatePlayerTargetRPC"); break; case EliteArchetype.Mentalist: Fields(typeof(EnemyFloater), "currentState", "stateTimer", "attackCount", "targetPlayer"); Methods(typeof(EnemyFloater), "UpdateState", "StateGoToPlayer"); break; case EliteArchetype.Headman: Fields(typeof(Enemy), "CurrentState", "DisableChaseTimer"); Fields(typeof(EnemyStateChase), "StateTimer"); break; case EliteArchetype.Headgrab: Fields(typeof(EnemyHeadGrabber), "currentState", "stateTimer", "attackCooldown", "headTargetCooldown", "attacksInRow", "headTargetActive"); break; case EliteArchetype.HeartHugger: Fields(typeof(EnemyHeartHugger), "currentState", "stateTimer", "attacksInARow"); Methods(typeof(EnemyHeartHugger), "StateSet", "LeaveStart"); break; case EliteArchetype.Hidden: Fields(typeof(EnemyHidden), "currentState", "stateTimer", "maxMoveTimer", "agentDestination", "playerTarget"); break; case EliteArchetype.Oogly: Fields(typeof(EnemyOogly), "currentState", "stateTimer", "attackCooldownTimer", "targetPlayer", "roamDestination", "currentRoamTarget", "headWorldTargetRotation"); Methods(typeof(EnemyOogly), "StateSet", "InitializeFlightSystem", "SetHeadTargetRotation"); break; case EliteArchetype.Robe: Fields(typeof(EnemyRobe), "currentState", "idleBreakTimer", "chaseTime", "targetPlayer", "isOnScreen"); Methods(typeof(EnemyRobe), "UpdateState", "MoveTowardPlayer"); break; case EliteArchetype.Reaper: Fields(typeof(EnemyRunner), "currentState", "stateTimer", "targetPlayer", "stateImpulse", "targetPosition", "agentSpeedCurrent"); Methods(typeof(EnemyRunner), "UpdateState", "StateAttackPlayer", "OnVision", "RotationLogic"); break; case EliteArchetype.Loom: Fields(typeof(PlayerAvatar), "rbVelocity"); Fields(typeof(EnemyShadow), "currentState", "stateTimer", "playerTarget"); Methods(typeof(EnemyShadow), "UpdatePlayerTarget", "StateChooseTarget"); break; case EliteArchetype.Spewer: Fields(typeof(EnemySlowMouth), "currentState", "stateTimer", "idlePukeCooldown", "possessCooldown", "attachedTimer"); Methods(typeof(EnemySlowMouth), "OnVision", "UpdatePlayerTarget"); break; case EliteArchetype.Trudge: Fields(typeof(EnemySlowWalker), "currentState", "stateTimer", "targetPlayer"); Methods(typeof(EnemySlowWalker), "UpdateState"); break; case EliteArchetype.Tick: Fields(typeof(EnemyTick), "currentState", "stateTimer", "suckTimer"); break; case EliteArchetype.Bella: Fields(typeof(EnemyTricycle), "currentState", "stateTimer", "attackCooldown"); Methods(typeof(EnemyTricycle), "SetState"); break; case EliteArchetype.Chef: Fields(typeof(EnemyTumbler), "currentState", "stateTimer", "roamWaitTimer", "targetPlayer"); Methods(typeof(EnemyTumbler), "UpdateState"); break; case EliteArchetype.Upscream: Fields(typeof(EnemyUpscream), "currentState", "stateTimer", "roamWaitTimer", "attacks", "targetPlayer"); Methods(typeof(EnemyUpscream), "UpdateState"); break; case EliteArchetype.Rugrat: Fields(typeof(EnemyValuableThrower), "currentState", "stateTimer", "attacks", "playerTarget", "valuableTarget"); Methods(typeof(EnemyValuableThrower), "UpdateState", "StateGetValuable", "StateGoToTarget"); Methods(typeof(EnemyJump), "StuckTrigger"); Methods(typeof(SemiFunc), "EnemyCartJump"); break; case EliteArchetype.Clown: Fields(typeof(EnemyBeamer), "aimHorizontalTarget", "aimHorizontalResult", "laserRange", "aimVerticalTarget"); Methods(typeof(EnemyBeamer), "RotationLogic", "VerticalAimLogic"); break; case EliteArchetype.ShadowChild: Fields(typeof(EnemyThinMan), "enemy", "playerTarget", "teleportPosition"); Methods(typeof(EnemyThinMan), "UpdateState", "SetTarget"); break; case EliteArchetype.Huntsman: Fields(typeof(EnemyHunter), "investigatePoint", "investigateAimHorizontal", "investigateAimVertical"); Methods(typeof(EnemyHunter), "AimLogic", "ShootRPC"); Methods(typeof(EnemyDirector), "SetInvestigate"); break; case EliteArchetype.Gambit: Fields(typeof(EnemySpinny), "reachedPoint"); Methods(typeof(EnemySpinny), "UpdateState", "JumpIfStuck", "RouletteGoingOn"); Methods(typeof(EnemyStateStunned), "Set"); break; case EliteArchetype.Banger: Methods(typeof(EnemyBang), "FuseLogic", "UpdateState", "ExplodeRPC"); break; case EliteArchetype.Gnome: Fields(typeof(EnemyGnome), "attackAngle"); Fields(typeof(EnemyGnomeDirector), "stateImpulse", "playerTarget", "valuableTarget"); Methods(typeof(EnemyGnome), "UpdateState", "StateNoticeDelay", "AttackPositionLogic", "StateAttackDone"); Methods(typeof(EnemyGnomeDirector), "UpdateState", "CanAttack", "StateAttackSet"); break; case EliteArchetype.Pony: Fields(typeof(EnemySnatcher), "playerTarget", "currentState", "stateImpulse", "agentDestination", "tongueRepositionStartPosition", "tongueRepositionPlayerPosition", "tongueRepositionDestinationTimer", "attackPauseTimer", "mainAttackCooldownTimer", "tongueAttackRecoveryTimer", "ceilingCooldownTimer"); Methods(typeof(EnemySnatcher), "Update", "StateNotice", "FindClosestVisiblePlayerTarget", "TongueRepositionDestinationPick", "TongueAttackCheck", "StateChase", "CeilingStateGround", "CeilingStateWatchdog", "SetStateGrabPhysObject", "PlayerVisible", "PlayerAttackCooldownActive", "SetPlayerTarget", "CeilingJumpTry", "CeilingWanderPathClear", "CeilingScareLanding", "CeilingDrop"); break; } Type type = archetype switch { EliteArchetype.Animal => typeof(EnemyAnimal), EliteArchetype.BirthdayBoy => typeof(EnemyBirthdayBoy), EliteArchetype.CleanupCrew => typeof(EnemyBombThrower), EliteArchetype.Bowtie => typeof(EnemyBowtie), EliteArchetype.Peeper => typeof(EnemyCeilingEye), EliteArchetype.ApexPredator => typeof(EnemyDuck), EliteArchetype.Elsa => typeof(EnemyElsa), EliteArchetype.Mentalist => typeof(EnemyFloater), EliteArchetype.Headman => typeof(Enemy), EliteArchetype.Headgrab => typeof(EnemyHeadGrabber), EliteArchetype.HeartHugger => typeof(EnemyHeartHugger), EliteArchetype.Hidden => typeof(EnemyHidden), EliteArchetype.Oogly => typeof(EnemyOogly), EliteArchetype.Robe => typeof(EnemyRobe), EliteArchetype.Reaper => typeof(EnemyRunner), EliteArchetype.Loom => typeof(EnemyShadow), EliteArchetype.Spewer => typeof(EnemySlowMouth), EliteArchetype.Trudge => typeof(EnemySlowWalker), EliteArchetype.Tick => typeof(EnemyTick), EliteArchetype.Bella => typeof(EnemyTricycle), EliteArchetype.Chef => typeof(EnemyTumbler), EliteArchetype.Upscream => typeof(EnemyUpscream), EliteArchetype.Rugrat => typeof(EnemyValuableThrower), _ => null, }; if (type != null) { Methods(type, "Update"); } } private static void Fields(Type type, params string[] names) { foreach (string text in names) { if (AccessTools.Field(type, text) == null) { throw new MissingFieldException(type.FullName, text); } } } private static void Methods(Type type, params string[] names) { foreach (string text in names) { if (AccessTools.Method(type, text, (Type[])null, (Type[])null) == null) { throw new MissingMethodException(type.FullName, text); } } } } [HarmonyPatch] internal static class BangerElitePatches { private static readonly Action<EnemyBang, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyBang, State>>(AccessTools.Method(typeof(EnemyBang), "UpdateState", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { state.AdapterState = new BangerRuntimeState(); } internal static void Tick(EliteState state) { } [HarmonyPrefix] [HarmonyPatch(typeof(EnemyBang), "FuseLogic")] private static bool FuseLogicPrefix(EnemyBang __instance) { //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) if (!EliteRegistry.TryGet((Component?)(object)__instance, out EliteState state)) { return true; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return true; } if (!GameFieldAccess.BangFuseActive(__instance)) { GetRuntime(state).PreviousFuseActive = false; return false; } EliteEnemyConfig settings = EliteEnemyVariantsPlugin.Instance.Settings; BangerRuntimeState runtime = GetRuntime(state); if (!runtime.PreviousFuseActive) { runtime.PreviousFuseActive = true; runtime.FuseStartedAt = Time.time; runtime.LastSyncAt = float.NegativeInfinity; } if (!EnemyBangDirector.instance.debugNoFuseProgress) { float num = Mathf.Max(0.5f, settings.BangerFuseSeconds.Value); if (HasNearVisibleTarget(state, settings.BangerNearTargetDistance.Value)) { num = Mathf.Min(num, Mathf.Max(0.5f, settings.BangerNearTargetFuseSeconds.Value)); } GameFieldAccess.SetBangFuseLerp(__instance, GameFieldAccess.BangFuseLerp(__instance) + Time.deltaTime / num); } GameFieldAccess.SetBangFuseLerp(__instance, Mathf.Clamp01(GameFieldAccess.BangFuseLerp(__instance))); if (GameManager.Multiplayer() && Time.time >= runtime.LastSyncAt + settings.BangerFuseSyncIntervalSeconds.Value) { runtime.LastSyncAt = Time.time; GameFieldAccess.BangPhotonView(__instance).RPC("FuseRPC", (RpcTarget)1, new object[2] { true, GameFieldAccess.BangFuseLerp(__instance) }); } if (GameFieldAccess.BangFuseLerp(__instance) < 1f) { return false; } if (GameManager.Multiplayer()) { GameFieldAccess.BangPhotonView(__instance).RPC("ExplodeRPC", (RpcTarget)0, Array.Empty<object>()); } else { AccessTools.Method(typeof(EnemyBang), "ExplodeRPC", (Type[])null, (Type[])null).Invoke(__instance, new object[1] { (object)default(PhotonMessageInfo) }); } UpdateState(__instance, (State)11); GameFieldAccess.Parent(GameFieldAccess.BangEnemy(__instance)).Despawn(); runtime.PreviousFuseActive = false; return false; } private static bool HasNearVisibleTarget(EliteState state, float maxDistance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_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_0115: 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_012e: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = GameFieldAccess.TargetPlayer(state.Enemy); if ((Object)(object)val == (Object)null || GameFieldAccess.PlayerDisabled(val)) { float num = float.MaxValue; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (DedicatedBehaviorSupport.CanUseAsUnseenTarget(item)) { float num2 = Vector3.Distance(state.Enemy.CenterTransform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val = item; } } } } if ((Object)(object)val == (Object)null) { return false; } PlayerVisionTarget playerVisionTarget = val.PlayerVisionTarget; Vector3? obj; if (playerVisionTarget == null) { obj = null; } else { Transform visionTransform = playerVisionTarget.VisionTransform; obj = ((visionTransform != null) ? new Vector3?(visionTransform.position) : ((Vector3?)null)); } Vector3 val2 = (Vector3)(((??)obj) ?? ((Component)val).transform.position) - state.Enemy.CenterTransform.position; if (((Vector3)(ref val2)).magnitude > maxDistance) { return false; } return !Physics.Raycast(state.Enemy.CenterTransform.position, ((Vector3)(ref val2)).normalized, ((Vector3)(ref val2)).magnitude, LayerMask.op_Implicit(GameFieldAccess.VisionMask(state.Enemy)), (QueryTriggerInteraction)1); } private static BangerRuntimeState GetRuntime(EliteState state) { BangerRuntimeState bangerRuntimeState = state.AdapterState as BangerRuntimeState; if (bangerRuntimeState == null) { bangerRuntimeState = (BangerRuntimeState)(state.AdapterState = new BangerRuntimeState()); } return bangerRuntimeState; } } [HarmonyPatch] internal static class ClownElitePatches { private static readonly FieldRef<EnemyBeamer, Quaternion> AimHorizontalTarget = AccessTools.FieldRefAccess<EnemyBeamer, Quaternion>("aimHorizontalTarget"); private static readonly FieldRef<EnemyBeamer, float> AimHorizontalResult = AccessTools.FieldRefAccess<EnemyBeamer, float>("aimHorizontalResult"); private static readonly FieldRef<EnemyBeamer, float> LaserRange = AccessTools.FieldRefAccess<EnemyBeamer, float>("laserRange"); private static readonly FieldRef<EnemyBeamer, Quaternion> AimVerticalTarget = AccessTools.FieldRefAccess<EnemyBeamer, Quaternion>("aimVerticalTarget"); internal static void OnSpawn(EliteState state) { state.AdapterState = new ClownRuntimeState(); } internal static void Tick(EliteState state) { //IL_0017: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Invalid comparison between Unknown and I4 //IL_00af: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Invalid comparison between Unknown and I4 //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Invalid comparison between Unknown and I4 //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Invalid comparison between Unknown and I4 //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) EnemyBeamer component = ((Component)state.Enemy).GetComponent<EnemyBeamer>(); if ((Object)(object)component == (Object)null) { return; } State currentState = component.currentState; bool flag = currentState - 4 <= 2; ClownRuntimeState runtime = GetRuntime(state); if (!flag) { runtime.AttackInitialized = false; runtime.TargetSwitched = false; runtime.SpinChecked = false; runtime.Spinning = false; return; } EliteEnemyConfig settings = EliteEnemyVariantsPlugin.Instance.Settings; LaserRange.Invoke(component) = settings.ClownBeamRange.Value; PlayerAvatar val = GameFieldAccess.BeamerTarget(component); if ((Object)(object)val != (Object)null) { runtime.LastTargetPosition = (((Object)(object)val.PlayerVisionTarget != (Object)null && (Object)(object)val.PlayerVisionTarget.VisionTransform != (Object)null) ? val.PlayerVisionTarget.VisionTransform.position : ((Component)val).transform.position); } if ((int)component.currentState == 5 && !runtime.AttackInitialized) { runtime.AttackInitialized = true; float value = settings.ClownBeamDurationMin.Value; float value2 = settings.ClownBeamDurationMax.Value; component.stateTimer = Mathf.Lerp(value, value2, StableUnit(state.Key, 17)); } if (settings.ClownWalkWhileAttacking.Value && (Object)(object)val != (Object)null) { EnemyNavMeshAgent val2 = GameFieldAccess.NavMeshAgent(state.Enemy); val2.Stop(0f); val2.SetDestination(((Component)val).transform.position); val2.OverrideAgent(GameFieldAccess.NavDefaultSpeed(val2), GameFieldAccess.NavDefaultAcceleration(val2), 0.1f); } if (settings.ClownTargetSwitch.Value && (int)component.currentState == 5 && !runtime.TargetSwitched && TryFindAlternateTarget(component, LaserRange.Invoke(component), out PlayerAvatar result)) { runtime.TargetSwitched = true; GameFieldAccess.SetBeamerTarget(component, result); state.Enemy.SetChaseTarget(result); if (GameManager.Multiplayer()) { GameFieldAccess.BeamerPhotonView(component).RPC("UpdatePlayerTargetRPC", (RpcTarget)1, new object[1] { result.photonView.ViewID }); } } if (!runtime.SpinChecked && (int)component.currentState == 5) { runtime.SpinChecked = true; float value3 = settings.ClownSpinChancePercent.Value; runtime.Spinning = StableUnit(state.Key, 41) * 100f < value3; runtime.SpinRemaining = (runtime.Spinning ? 180f : 0f); runtime.SpinYaw = ((Component)component).transform.eulerAngles.y; } if ((int)component.currentState == 5 && (Object)(object)GameFieldAccess.BeamerTarget(component) == (Object)null && runtime.LastTargetPosition != Vector3.zero && !runtime.Spinning) { runtime.Spinning = true; runtime.SpinRemaining = 180f; runtime.SpinYaw = ((Component)component).transform.eulerAngles.y; } } [HarmonyPrefix] [HarmonyPatch(typeof(EnemyBeamer), "RotationLogic")] private static void RotationLogicPrefix(EnemyBeamer __instance) { //IL_000c: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00aa: 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_0095: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00db: 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_00ef: Unknown result type (might be due to invalid IL or missing references) if (!EliteRegistry.TryGet((Component?)(object)__instance, out EliteState state)) { return; } State currentState = __instance.currentState; if (currentState - 4 > 2) { return; } ClownRuntimeState runtime = GetRuntime(state); PlayerAvatar val = GameFieldAccess.BeamerTarget(__instance); ? val2; if (!((Object)(object)val != (Object)null)) { val2 = runtime.LastTargetPosition; } else { PlayerVisionTarget playerVisionTarget = val.PlayerVisionTarget; Vector3? obj; if (playerVisionTarget == null) { obj = null; } else { Transform visionTransform = playerVisionTarget.VisionTransform; obj = ((visionTransform != null) ? new Vector3?(visionTransform.position) : ((Vector3?)null)); } val2 = ((??)obj) ?? ((Component)val).transform.position; } Vector3 val3 = (Vector3)val2 - __instance.bottomTransform.position; if (((Vector3)(ref val3)).sqrMagnitude > 0.001f && !runtime.Spinning) { Quaternion val4 = Quaternion.LookRotation(val3); AimHorizontalTarget.Invoke(__instance) = Quaternion.Euler(0f, ((Quaternion)(ref val4)).eulerAngles.y, 0f); AimHorizontalResult.Invoke(__instance) = 0f; } __instance.horizontalRotationSpring.speed = EliteEnemyVariantsPlugin.Instance.Settings.ClownTrackSpeed.Value; } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyBeamer), "RotationLogic")] private static void RotationLogicPostfix(EnemyBeamer __instance) { //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) if (!EliteRegistry.TryGet((Component?)(object)__instance, out EliteState state)) { return; } ClownRuntimeState runtime = GetRuntime(state); if (!runtime.Spinning || runtime.SpinRemaining <= 0f) { PlayerAvatar val = GameFieldAccess.BeamerTarget(__instance); if ((Object)(object)val != (Object)null) { PlayerVisionTarget playerVisionTarget = val.PlayerVisionTarget; Vector3? obj; if (playerVisionTarget == null) { obj = null; } else { Transform visionTransform = playerVisionTarget.VisionTransform; obj = ((visionTransform != null) ? new Vector3?(visionTransform.position) : ((Vector3?)null)); } Vector3 val2 = (Vector3)(((??)obj) ?? ((Component)val).transform.position) - ((Component)__instance).transform.position; if (((Vector3)(ref val2)).sqrMagnitude > 0.001f) { Quaternion val3 = Quaternion.LookRotation(val2); Quaternion val4 = Quaternion.Euler(0f, ((Quaternion)(ref val3)).eulerAngles.y, 0f); ((Component)__instance).transform.rotation = Quaternion.RotateTowards(((Component)__instance).transform.rotation, val4, EliteEnemyVariantsPlugin.Instance.Settings.ClownTrackSpeed.Value * Time.deltaTime); } } } else { float num = Mathf.Min(runtime.SpinRemaining, EliteEnemyVariantsPlugin.Instance.Settings.ClownSpinSpeedDegPerSec.Value * Time.deltaTime); runtime.SpinYaw = Mathf.Repeat(runtime.SpinYaw + num, 360f); runtime.SpinRemaining -= num; ((Component)__instance).transform.rotation = Quaternion.Euler(0f, runtime.SpinYaw, 0f); if (runtime.SpinRemaining <= 0f) { runtime.Spinning = false; } } } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyBeamer), "VerticalAimLogic")] private static void VerticalAimLogicPostfix(EnemyBeamer __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_002e: Invalid comparison between Unknown and I4 //IL_006f: 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_008a: 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_00a3: 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_00b8: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_00f4: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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) PlayerAvatar val = GameFieldAccess.BeamerTarget(__instance); EliteState state; bool flag = !EliteRegistry.TryGet((Component?)(object)__instance, out state) || (Object)(object)val == (Object)null; if (!flag) { State currentState = __instance.currentState; bool flag2 = currentState - 4 <= 2; flag = !flag2; } if (!flag) { PlayerVisionTarget playerVisionTarget = val.PlayerVisionTarget; Vector3? obj; if (playerVisionTarget == null) { obj = null; } else { Transform visionTransform = playerVisionTarget.VisionTransform; obj = ((visionTransform != null) ? new Vector3?(visionTransform.position) : ((Vector3?)null)); } Vector3 val2 = (Vector3)(((??)obj) ?? ((Component)val).transform.position) - __instance.laserRayTransform.position; if (!(((Vector3)(ref val2)).sqrMagnitude <= 0.001f)) { Quaternion val3 = Quaternion.LookRotation(val2); Quaternion val4 = Quaternion.Inverse(((Object)(object)__instance.aimVerticalTransform.parent != (Object)null) ? __instance.aimVerticalTransform.parent.rotation : Quaternion.identity) * val3; val4 = Quaternion.Euler(((Quaternion)(ref val4)).eulerAngles.x, 0f, 0f); float value = EliteEnemyVariantsPlugin.Instance.Settings.ClownTrackSpeed.Value; AimVerticalTarget.Invoke(__instance) = Quaternion.RotateTowards(AimVerticalTarget.Invoke(__instance), val4, value * Time.deltaTime); __instance.aimVerticalTransform.localRotation = AimVerticalTarget.Invoke(__instance); __instance.laserRayTransform.localRotation = AimVerticalTarget.Invoke(__instance); } } } private static ClownRuntimeState GetRuntime(EliteState state) { ClownRuntimeState clownRuntimeState = state.AdapterState as ClownRuntimeState; if (clownRuntimeState == null) { clownRuntimeState = (ClownRuntimeState)(state.AdapterState = new ClownRuntimeState()); } return clownRuntimeState; } private static bool TryFindAlternateTarget(EnemyBeamer clown, float range, out PlayerAvatar result) { //IL_0068: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) result = null; List<PlayerAvatar> list = new List<PlayerAvatar>(); foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (DedicatedBehaviorSupport.CanUseAsUnseenTarget(item) && !((Object)(object)item == (Object)(object)GameFieldAccess.BeamerTarget(clown))) { PlayerVisionTarget playerVisionTarget = item.PlayerVisionTarget; Vector3? obj; if (playerVisionTarget == null) { obj = null; } else { Transform visionTransform = playerVisionTarget.VisionTransform; obj = ((visionTransform != null) ? new Vector3?(visionTransform.position) : ((Vector3?)null)); } Vector3 val = (Vector3)(((??)obj) ?? ((Component)item).transform.position) - clown.bottomTransform.position; if (!(((Vector3)(ref val)).magnitude > range) && !Physics.Raycast(clown.bottomTransform.position, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(GameFieldAccess.VisionMask(GameFieldAccess.BeamerEnemy(clown))), (QueryTriggerInteraction)1)) { list.Add(item); } } } if (list.Count == 0) { return false; } int index = Mathf.Abs(((Object)clown).GetInstanceID()) % list.Count; result = list[index]; return true; } private static float StableUnit(int key, int salt) { int num = key * 1103515245 + salt * 12345; return (float)(uint)((num ^ (num >>> 16)) & 0xFFFFFF) / 16777216f; } } internal static class DedicatedBehaviorSupport { internal static void OnSpawn(EliteState state) { //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) state.AdapterState = new DedicatedEnemyRuntimeState { SpawnInitialized = true, LastPosition = ((Component)state.Enemy).transform.position }; } internal static DedicatedEnemyRuntimeState Runtime(EliteState state) { //IL_0027: 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) DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = state.AdapterState as DedicatedEnemyRuntimeState; if (dedicatedEnemyRuntimeState == null) { dedicatedEnemyRuntimeState = (DedicatedEnemyRuntimeState)(state.AdapterState = new DedicatedEnemyRuntimeState { SpawnInitialized = true, LastPosition = ((Component)state.Enemy).transform.position }); } return dedicatedEnemyRuntimeState; } internal static bool IsValidTarget(PlayerAvatar? player) { if ((Object)(object)player != (Object)null) { return !GameFieldAccess.PlayerDisabled(player); } return false; } internal static bool CanUseAsUnseenTarget(PlayerAvatar? player) { if (IsValidTarget(player)) { return RoleShuffleCompatibility.CanUseAsUnseenEnemyTarget(player); } return false; } internal static bool TryFindNearestPlayer(Vector3 origin, float maxDistance, out PlayerAvatar result, PlayerAvatar? exclude = null, Enemy? lineOfSightEnemy = null) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00bd: Unknown result type (might be due to invalid IL or missing references) result = null; float num = maxDistance; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (CanUseAsUnseenTarget(item) && !((Object)(object)item == (Object)(object)exclude)) { PlayerVisionTarget playerVisionTarget = item.PlayerVisionTarget; Vector3? obj; if (playerVisionTarget == null) { obj = null; } else { Transform visionTransform = playerVisionTarget.VisionTransform; obj = ((visionTransform != null) ? new Vector3?(visionTransform.position) : ((Vector3?)null)); } Vector3 val = (Vector3)(((??)obj) ?? ((Component)item).transform.position) - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude > num) && (!((Object)(object)lineOfSightEnemy != (Object)null) || !(magnitude > 0.01f) || !Physics.Raycast(origin, val / magnitude, magnitude, LayerMask.op_Implicit(GameFieldAccess.VisionMask(lineOfSightEnemy)), (QueryTriggerInteraction)1))) { num = magnitude; result = item; } } } return (Object)(object)result != (Object)null; } internal static void TrackState(DedicatedEnemyRuntimeState runtime, int currentState) { runtime.PreviousState = currentState; } internal static void Run<T>(T instance, EliteArchetype archetype, Action<EliteState, T> action) where T : Component { if (!SemiFunc.IsMasterClientOrSingleplayer() || !EliteRegistry.TryGet((Component?)(object)instance, out EliteState state) || state.Archetype != archetype || !state.Spawned || state.AdapterTickFaulted) { return; } try { action(state, instance); EliteRegistry.RecordAdapterTickSuccess(state); } catch (Exception exception) { EliteRegistry.RecordAdapterTickFailure(state, exception, "AI postfix"); } } internal static float WindupRate(EliteState state) { return EliteEnemyVariantsPlugin.Instance.Settings.BehaviorWindupRate.Value; } internal static float CooldownRate(EliteState state) { return EliteEnemyVariantsPlugin.Instance.Settings.BehaviorCooldownRate.Value; } internal static float Retention(EliteState state) { return EliteEnemyVariantsPlugin.Instance.Settings.BehaviorChaseRetention.Value; } internal static void Countdown<T>(T instance, FieldRef<T, float> field, float rate) { float num = field.Invoke(instance); if (rate > 1f && num > 0f) { field.Invoke(instance) = Mathf.Max(0f, num - Time.deltaTime * (rate - 1f)); } } internal static void Countup<T>(T instance, FieldRef<T, float> field, float rate) { if (rate > 1f) { field.Invoke(instance) = field.Invoke(instance) + Time.deltaTime * (rate - 1f); } } internal static void RetainCountup<T>(T instance, FieldRef<T, float> field, float retention) { float num = field.Invoke(instance); if (retention > 0f && num > 0f) { field.Invoke(instance) = Mathf.Max(0f, num - Time.deltaTime * retention); } } internal static void RetainCountdown<T>(T instance, FieldRef<T, float> field, float retention) { float num = field.Invoke(instance); if (retention > 0f && num > 0f) { field.Invoke(instance) = num + Time.deltaTime * retention; } } } [HarmonyPatch] internal static class AnimalElitePatches { private static readonly Action<EnemyAnimal, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyAnimal, State>>(AccessTools.Method(typeof(EnemyAnimal), "UpdateState", (Type[])null, (Type[])null), (object)null, true); private static readonly FieldRef<EnemyAnimal, float> StateTimer = AccessTools.FieldRefAccess<EnemyAnimal, float>("stateTimer"); private static readonly FieldRef<EnemyAnimal, float> HavocTimer = AccessTools.FieldRefAccess<EnemyAnimal, float>("havocTimer"); private static readonly FieldRef<EnemyAnimal, PlayerAvatar> PlayerTarget = AccessTools.FieldRefAccess<EnemyAnimal, PlayerAvatar>("playerTarget"); private static readonly FieldRef<EnemyAnimal, Vector3> AgentDestination = AccessTools.FieldRefAccess<EnemyAnimal, Vector3>("agentDestination"); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyAnimal animal) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Invalid comparison between Unknown and I4 //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected I4, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); if ((int)animal.currentState == 4) { DedicatedBehaviorSupport.Countdown<EnemyAnimal>(animal, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } else if ((int)animal.currentState == 6) { DedicatedBehaviorSupport.Countdown<EnemyAnimal>(animal, HavocTimer, DedicatedBehaviorSupport.CooldownRate(state)); if (dedicatedEnemyRuntimeState.PreviousState != 6) { dedicatedEnemyRuntimeState.Tactics.NextScanAt = 0f; } if (TacticalPositioning.AnimalDestination(state, PlayerTarget.Invoke(animal), dedicatedEnemyRuntimeState.Tactics, out var point)) { AgentDestination.Invoke(animal) = point; GameFieldAccess.NavMeshAgent(state.Enemy).SetDestination(point); HavocTimer.Invoke(animal) = Mathf.Max(HavocTimer.Invoke(animal), 0.3f); } } if (dedicatedEnemyRuntimeState.PreviousState == 6 && (int)animal.currentState == 7 && !dedicatedEnemyRuntimeState.ExtraActionUsed && DedicatedBehaviorSupport.IsValidTarget(PlayerTarget.Invoke(animal))) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; UpdateState(animal, (State)5); } if ((int)animal.currentState == 4 && dedicatedEnemyRuntimeState.PreviousState != 4) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)animal.currentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyAnimal), "Update")] private static void UpdatePostfix(EnemyAnimal __instance) { DedicatedBehaviorSupport.Run<EnemyAnimal>(__instance, EliteArchetype.Animal, (Action<EliteState, EnemyAnimal>)Tick); } } [HarmonyPatch] internal static class BirthdayBoyElitePatches { private static readonly FieldRef<EnemyBirthdayBoy, float> StateTimer = AccessTools.FieldRefAccess<EnemyBirthdayBoy, float>("stateTimer"); private static readonly FieldRef<EnemyBirthdayBoy, float> SecondStateTimer = AccessTools.FieldRefAccess<EnemyBirthdayBoy, float>("secondStateTimer"); private static readonly FieldRef<EnemyBirthdayBoy, PhotonView> PhotonViewRef = AccessTools.FieldRefAccess<EnemyBirthdayBoy, PhotonView>("photonView"); private static readonly Action<EnemyBirthdayBoy, PlayerAvatar> UpdatePlayerTarget = AccessTools.MethodDelegate<Action<EnemyBirthdayBoy, PlayerAvatar>>(AccessTools.Method(typeof(EnemyBirthdayBoy), "UpdatePlayerTarget", (Type[])null, (Type[])null), (object)null, true); private static readonly Action<EnemyBirthdayBoy, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyBirthdayBoy, State>>(AccessTools.Method(typeof(EnemyBirthdayBoy), "UpdateState", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyBirthdayBoy enemy) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 if ((int)enemy.currentState == 8) { DedicatedBehaviorSupport.Countdown<EnemyBirthdayBoy>(enemy, SecondStateTimer, DedicatedBehaviorSupport.WindupRate(state)); } else if ((int)enemy.currentState == 13) { DedicatedBehaviorSupport.RetainCountdown<EnemyBirthdayBoy>(enemy, StateTimer, DedicatedBehaviorSupport.Retention(state)); } } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyBirthdayBoy), "Update")] private static void UpdatePostfix(EnemyBirthdayBoy __instance) { DedicatedBehaviorSupport.Run<EnemyBirthdayBoy>(__instance, EliteArchetype.BirthdayBoy, (Action<EliteState, EnemyBirthdayBoy>)Tick); } [HarmonyPrefix] [HarmonyPatch(typeof(EnemyBirthdayBoy), "CheckForPoppedBalloons")] private static void CheckForPoppedBalloonsPrefix(EnemyBirthdayBoy __instance, ref PlayerAvatar? __state) { __state = null; if (!SemiFunc.IsMasterClientOrSingleplayer() || !EliteRegistry.TryGet((Component?)(object)__instance, out EliteState _)) { return; } foreach (GameObject value in __instance.balloons.Values) { BirthdayBoyBalloon val = (((Object)(object)value != (Object)null) ? value.GetComponentInChildren<BirthdayBoyBalloon>() : null); if ((Object)(object)val != (Object)null && val.popped && DedicatedBehaviorSupport.IsValidTarget(val.popper)) { __state = val.popper; break; } } } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyBirthdayBoy), "CheckForPoppedBalloons")] private static void CheckForPoppedBalloonsPostfix(EnemyBirthdayBoy __instance, PlayerAvatar? __state) { if (SemiFunc.IsMasterClientOrSingleplayer() && !((Object)(object)__state == (Object)null) && EliteRegistry.TryGet((Component?)(object)__instance, out EliteState _)) { UpdatePlayerTarget(__instance, __state); if (GameManager.Multiplayer()) { PhotonViewRef.Invoke(__instance).RPC("UpdatePlayerTargetRPC", (RpcTarget)1, new object[1] { __state.photonView.ViewID }); } StateTimer.Invoke(__instance) = 20f; UpdateState(__instance, (State)13); } } } [HarmonyPatch] internal static class CleanupCrewElitePatches { private static readonly FieldRef<EnemyBombThrowerHead, State> HeadState = AccessTools.FieldRefAccess<EnemyBombThrowerHead, State>("currentState"); private static readonly FieldRef<EnemyBombThrower, State> CurrentState = AccessTools.FieldRefAccess<EnemyBombThrower, State>("currentState"); private static readonly FieldRef<EnemyBombThrower, float> StateTimer = AccessTools.FieldRefAccess<EnemyBombThrower, float>("stateTimer"); private static readonly FieldRef<EnemyBombThrower, float> HeadCooldown = AccessTools.FieldRefAccess<EnemyBombThrower, float>("headCooldown"); private static readonly FieldRef<EnemyBombThrower, float> HeadAttackCooldown = AccessTools.FieldRefAccess<EnemyBombThrower, float>("headAttackCooldown"); private static readonly FieldRef<EnemyBombThrower, float> MeleeCooldown = AccessTools.FieldRefAccess<EnemyBombThrower, float>("meleeCooldown"); private static readonly FieldRef<EnemyBombThrower, PlayerAvatar> PlayerTarget = AccessTools.FieldRefAccess<EnemyBombThrower, PlayerAvatar>("playerTarget"); private static readonly Action<EnemyBombThrower, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyBombThrower, State>>(AccessTools.Method(typeof(EnemyBombThrower), "UpdateState", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyBombThrower enemy) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); if ((int)CurrentState.Invoke(enemy) == 8 && dedicatedEnemyRuntimeState.PreviousState != 8) { dedicatedEnemyRuntimeState.Tactics.ResetFlank(); } if ((int)CurrentState.Invoke(enemy) == 4) { DedicatedBehaviorSupport.Countdown<EnemyBombThrower>(enemy, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } float rate = DedicatedBehaviorSupport.CooldownRate(state); DedicatedBehaviorSupport.Countdown<EnemyBombThrower>(enemy, HeadCooldown, rate); DedicatedBehaviorSupport.Countdown<EnemyBombThrower>(enemy, HeadAttackCooldown, rate); DedicatedBehaviorSupport.Countdown<EnemyBombThrower>(enemy, MeleeCooldown, rate); if (dedicatedEnemyRuntimeState.PreviousState == 8 && (int)CurrentState.Invoke(enemy) == 7 && !dedicatedEnemyRuntimeState.ExtraActionUsed && DedicatedBehaviorSupport.IsValidTarget(PlayerTarget.Invoke(enemy)) && Vector3.Distance(((Component)enemy).transform.position, ((Component)PlayerTarget.Invoke(enemy)).transform.position) <= 4f) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; UpdateState(enemy, (State)9); } if ((int)CurrentState.Invoke(enemy) == 4 && dedicatedEnemyRuntimeState.PreviousState != 4) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)CurrentState.Invoke(enemy)); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyBombThrower), "Update")] private static void UpdatePostfix(EnemyBombThrower __instance) { DedicatedBehaviorSupport.Run<EnemyBombThrower>(__instance, EliteArchetype.CleanupCrew, (Action<EliteState, EnemyBombThrower>)Tick); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyBombThrower), "StateBackAwayHead")] private static void BackAwayHeadPostfix(EnemyBombThrower __instance) { DedicatedBehaviorSupport.Run<EnemyBombThrower>(__instance, EliteArchetype.CleanupCrew, (Action<EliteState, EnemyBombThrower>)delegate(EliteState state, EnemyBombThrower enemy) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) if (TacticalPositioning.IsActive((Component)(object)enemy, out EliteState _) && (int)CurrentState.Invoke(enemy) == 7) { TacticalRuntimeState tactics = DedicatedBehaviorSupport.Runtime(state).Tactics; if ((Object)(object)enemy.head == (Object)null || (int)HeadState.Invoke(enemy.head) != 2) { if (tactics.FlankMoving) { GameFieldAccess.NavMeshAgent(state.Enemy).ResetPath(); } tactics.FlankMoving = false; } else { Vector3 position = ((Component)enemy.head).transform.position; if (Vector3.Distance(((Component)enemy).transform.position, position) < 6f) { tactics.FlankMoving = false; } else if (!TacticalPositioning.VisiblePlayer(state.Enemy, PlayerTarget.Invoke(enemy))) { if (tactics.FlankMoving) { GameFieldAccess.NavMeshAgent(state.Enemy).ResetPath(); } tactics.FlankMoving = false; } else { if (!tactics.FlankAttempted) { tactics.FlankAttempted = true; if (TacticalPositioning.BombPincer(state, PlayerTarget.Invoke(enemy), position, out var point)) { tactics.BeginFlank(point); } } bool flankMoving = tactics.FlankMoving; if (tactics.ContinueFlank(((Component)enemy).transform.position)) { if (TacticalPositioning.SafeBombRoute(state, position, tactics.FlankPoint)) { GameFieldAccess.NavMeshAgent(state.Enemy).SetDestination(tactics.FlankPoint); } else { tactics.FlankMoving = false; GameFieldAccess.NavMeshAgent(state.Enemy).ResetPath(); } } else if (flankMoving) { GameFieldAccess.NavMeshAgent(state.Enemy).ResetPath(); } } } } }); } } [HarmonyPatch] internal static class BowtieElitePatches { private static readonly FieldRef<EnemyBowtie, float> StateTimer = AccessTools.FieldRefAccess<EnemyBowtie, float>("stateTimer"); private static readonly Action<EnemyBowtie, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyBowtie, State>>(AccessTools.Method(typeof(EnemyBowtie), "UpdateState", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyBowtie enemy) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected I4, but got Unknown DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); if ((int)enemy.currentState == 4) { DedicatedBehaviorSupport.Countdown<EnemyBowtie>(enemy, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } else if ((int)enemy.currentState == 6) { DedicatedBehaviorSupport.Countdown<EnemyBowtie>(enemy, StateTimer, DedicatedBehaviorSupport.CooldownRate(state)); } bool flag = dedicatedEnemyRuntimeState.PreviousState == 6; if (flag) { State currentState = enemy.currentState; bool flag2 = (((int)currentState == 1 || (int)currentState == 7) ? true : false); flag = flag2; } if (flag && !dedicatedEnemyRuntimeState.ExtraActionUsed) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; UpdateState(enemy, (State)5); } if ((int)enemy.currentState == 4 && dedicatedEnemyRuntimeState.PreviousState != 4) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)enemy.currentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyBowtie), "Update")] private static void UpdatePostfix(EnemyBowtie __instance) { DedicatedBehaviorSupport.Run<EnemyBowtie>(__instance, EliteArchetype.Bowtie, (Action<EliteState, EnemyBowtie>)Tick); } } [HarmonyPatch] internal static class PeeperElitePatches { private static readonly FieldRef<EnemyCeilingEye, float> DamageWaitTimer = AccessTools.FieldRefAccess<EnemyCeilingEye, float>("eyeDamageWaitTimer"); private static readonly FieldRef<EnemyCeilingEye, float> DamageTimer = AccessTools.FieldRefAccess<EnemyCeilingEye, float>("eyeDamageTimer"); private static readonly FieldRef<EnemyCeilingEye, PlayerAvatar> PlayerTarget = AccessTools.FieldRefAccess<EnemyCeilingEye, PlayerAvatar>("targetPlayer"); private static readonly FieldRef<EnemyCeilingEye, PhotonView> PhotonViewRef = AccessTools.FieldRefAccess<EnemyCeilingEye, PhotonView>("photonView"); private static readonly Action<EnemyCeilingEye, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyCeilingEye, State>>(AccessTools.Method(typeof(EnemyCeilingEye), "UpdateState", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyCeilingEye enemy) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected I4, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); if ((int)enemy.currentState == 3) { DedicatedBehaviorSupport.Countdown<EnemyCeilingEye>(enemy, DamageWaitTimer, DedicatedBehaviorSupport.WindupRate(state)); DedicatedBehaviorSupport.Countdown<EnemyCeilingEye>(enemy, DamageTimer, DedicatedBehaviorSupport.CooldownRate(state)); } if (dedicatedEnemyRuntimeState.PreviousState == 3 && (int)enemy.currentState == 2 && !dedicatedEnemyRuntimeState.ExtraActionUsed && DedicatedBehaviorSupport.TryFindNearestPlayer(enemy.eyeTransform.position, 20f, out PlayerAvatar result, PlayerTarget.Invoke(enemy), state.Enemy)) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; PlayerTarget.Invoke(enemy) = result; if (GameManager.Multiplayer()) { PhotonViewRef.Invoke(enemy).RPC("TargetPlayerRPC", (RpcTarget)1, new object[1] { result.photonView.ViewID }); } UpdateState(enemy, (State)3); } if ((int)enemy.currentState == 0) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)enemy.currentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyCeilingEye), "Update")] private static void UpdatePostfix(EnemyCeilingEye __instance) { DedicatedBehaviorSupport.Run<EnemyCeilingEye>(__instance, EliteArchetype.Peeper, (Action<EliteState, EnemyCeilingEye>)Tick); } } [HarmonyPatch] internal static class ApexPredatorElitePatches { private static readonly FieldRef<EnemyDuck, float> StateTimer = AccessTools.FieldRefAccess<EnemyDuck, float>("stateTimer"); private static readonly FieldRef<EnemyDuck, float> ChaseTimer = AccessTools.FieldRefAccess<EnemyDuck, float>("chaseTimer"); private static readonly FieldRef<EnemyDuck, PlayerAvatar> PlayerTarget = AccessTools.FieldRefAccess<EnemyDuck, PlayerAvatar>("playerTarget"); private static readonly Action<EnemyDuck, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyDuck, State>>(AccessTools.Method(typeof(EnemyDuck), "UpdateState", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyDuck enemy) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0034: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected I4, but got Unknown DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); State currentState = enemy.currentState; if (((int)currentState == 4 || currentState - 11 <= 1) ? true : false) { DedicatedBehaviorSupport.Countdown<EnemyDuck>(enemy, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } currentState = enemy.currentState; if (currentState - 13 <= 2) { DedicatedBehaviorSupport.RetainCountup<EnemyDuck>(enemy, ChaseTimer, DedicatedBehaviorSupport.Retention(state)); } bool flag = (int)enemy.currentState == 16; if (flag) { int previousState = dedicatedEnemyRuntimeState.PreviousState; bool flag2 = (uint)(previousState - 13) <= 2u; flag = flag2; } if (flag && !dedicatedEnemyRuntimeState.ExtraActionUsed && DedicatedBehaviorSupport.IsValidTarget(PlayerTarget.Invoke(enemy))) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; UpdateState(enemy, (State)11); } if ((int)enemy.currentState == 4 && dedicatedEnemyRuntimeState.PreviousState != 4) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)enemy.currentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyDuck), "Update")] private static void UpdatePostfix(EnemyDuck __instance) { DedicatedBehaviorSupport.Run<EnemyDuck>(__instance, EliteArchetype.ApexPredator, (Action<EliteState, EnemyDuck>)Tick); } } [HarmonyPatch] internal static class ElsaElitePatches { private static readonly FieldRef<EnemyElsa, float> StateTimer = AccessTools.FieldRefAccess<EnemyElsa, float>("stateTimer"); private static readonly FieldRef<EnemyElsa, float> AngryTimer = AccessTools.FieldRefAccess<EnemyElsa, float>("angryTimer"); private static readonly FieldRef<EnemyElsa, float> ChaseTimer = AccessTools.FieldRefAccess<EnemyElsa, float>("chaseTimer"); private static readonly FieldRef<EnemyElsa, PlayerAvatar> PlayerTarget = AccessTools.FieldRefAccess<EnemyElsa, PlayerAvatar>("playerTarget"); private static readonly FieldRef<EnemyElsa, PhotonView> PhotonViewRef = AccessTools.FieldRefAccess<EnemyElsa, PhotonView>("photonView"); private static readonly Action<EnemyElsa, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyElsa, State>>(AccessTools.Method(typeof(EnemyElsa), "UpdateState", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyElsa enemy) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0049: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Invalid comparison between Unknown and I4 //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected I4, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); if ((int)enemy.currentState == 5) { DedicatedBehaviorSupport.Countdown<EnemyElsa>(enemy, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } State currentState = enemy.currentState; if (currentState - 6 <= 2) { DedicatedBehaviorSupport.Countup<EnemyElsa>(enemy, AngryTimer, DedicatedBehaviorSupport.WindupRate(state)); } currentState = enemy.currentState; if ((currentState - 18 <= 1 || (int)currentState == 22) ? true : false) { DedicatedBehaviorSupport.RetainCountup<EnemyElsa>(enemy, ChaseTimer, DedicatedBehaviorSupport.Retention(state)); } if ((int)enemy.currentState == 25 && dedicatedEnemyRuntimeState.PreviousState != 25 && !dedicatedEnemyRuntimeState.ExtraActionUsed && DedicatedBehaviorSupport.TryFindNearestPlayer(((Component)enemy).transform.position, 15f, out PlayerAvatar result, PlayerTarget.Invoke(enemy), state.Enemy)) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; PlayerTarget.Invoke(enemy) = result; GameFieldAccess.SetTargetPlayer(state.Enemy, result); GameFieldAccess.SetTargetPlayerViewId(state.Enemy, result.photonView.ViewID); if (GameManager.Multiplayer()) { PhotonViewRef.Invoke(enemy).RPC("UpdatePlayerTargetRPC", (RpcTarget)1, new object[1] { result.photonView.ViewID }); } ChaseTimer.Invoke(enemy) = 0f; UpdateState(enemy, (State)18); } if ((int)enemy.currentState == 5 && dedicatedEnemyRuntimeState.PreviousState != 5) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)enemy.currentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyElsa), "Update")] private static void UpdatePostfix(EnemyElsa __instance) { DedicatedBehaviorSupport.Run<EnemyElsa>(__instance, EliteArchetype.Elsa, (Action<EliteState, EnemyElsa>)Tick); } } [HarmonyPatch] internal static class MentalistElitePatches { private static readonly FieldRef<EnemyFloater, PlayerAvatar> PlayerTarget = AccessTools.FieldRefAccess<EnemyFloater, PlayerAvatar>("targetPlayer"); private static readonly FieldRef<EnemyFloater, float> StateTimer = AccessTools.FieldRefAccess<EnemyFloater, float>("stateTimer"); private static readonly Action<EnemyFloater, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyFloater, State>>(AccessTools.Method(typeof(EnemyFloater), "UpdateState", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyFloater enemy) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0041: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected I4, but got Unknown DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); State currentState = enemy.currentState; if (((int)currentState == 4 || currentState - 7 <= 1) ? true : false) { DedicatedBehaviorSupport.Countdown<EnemyFloater>(enemy, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } bool flag = dedicatedEnemyRuntimeState.PreviousState == 9; if (flag) { currentState = enemy.currentState; bool flag2 = (((int)currentState == 1 || (int)currentState == 11) ? true : false); flag = flag2; } if (flag && !dedicatedEnemyRuntimeState.ExtraActionUsed) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; UpdateState(enemy, (State)8); } if ((int)enemy.currentState == 4 && dedicatedEnemyRuntimeState.PreviousState != 4) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)enemy.currentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyFloater), "Update")] private static void UpdatePostfix(EnemyFloater __instance) { DedicatedBehaviorSupport.Run<EnemyFloater>(__instance, EliteArchetype.Mentalist, (Action<EliteState, EnemyFloater>)Tick); } [HarmonyPrefix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyFloater), "UpdateState")] private static void UpdateStatePrefix(EnemyFloater __instance, ref State _state) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0020: 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_0025: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (!TacticalPositioning.IsActive((Component)(object)__instance, out EliteState state)) { return; } TacticalRuntimeState tactics = DedicatedBehaviorSupport.Runtime(state).Tactics; try { State val = _state; if ((val - 1 <= 1 || val - 10 <= 2) ? true : false) { tactics.Repositioning = false; tactics.PreparationUsed = false; } if ((int)_state == 7 && !tactics.PreparationUsed) { tactics.PreparationUsed = true; if (TacticalPositioning.MentalistPosition(state, __instance, PlayerTarget.Invoke(__instance), out var point)) { tactics.BeginReposition(PlayerTarget.Invoke(__instance), point, Time.time); _state = (State)5; } } } catch (Exception exception) { tactics.Repositioning = false; EliteRegistry.RecordAdapterTickFailure(state, exception, "Mentalist positioning"); } } [HarmonyPrefix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyFloater), "StateGoToPlayer")] private static bool StateGoToPlayerPrefix(EnemyFloater __instance) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) if (!TacticalPositioning.IsActive((Component)(object)__instance, out EliteState state)) { return true; } TacticalRuntimeState tactics = DedicatedBehaviorSupport.Runtime(state).Tactics; if (!tactics.Repositioning) { return true; } try { PlayerAvatar val = PlayerTarget.Invoke(__instance); bool flag = (Object)(object)val == (Object)(object)tactics.RepositionTarget && TacticalPositioning.VisiblePlayer(state.Enemy, val); bool flag2 = SemiFunc.EnemyForceLeave(state.Enemy); bool flag3 = Time.time >= tactics.RepositionDeadline || Vector3.Distance(__instance.feetTransform.position, tactics.RepositionPoint) <= 0.65f; if (flag2 || !flag || flag3) { tactics.Repositioning = false; State arg = (State)(flag2 ? 11 : ((!flag || !(Vector3.Distance(__instance.feetTransform.position, ((Component)val).transform.position) <= 4f)) ? 1 : 7)); UpdateState(__instance, arg); return false; } EnemyNavMeshAgent val2 = GameFieldAccess.NavMeshAgent(state.Enemy); val2.SetDestination(tactics.RepositionPoint); val2.OverrideAgent(2f, GameFieldAccess.NavDefaultAcceleration(val2), 0.2f); return false; } catch (Exception exception) { tactics.Repositioning = false; EliteRegistry.RecordAdapterTickFailure(state, exception, "Mentalist positioning movement"); return true; } } } [HarmonyPatch] internal static class HeadmanElitePatches { private static readonly FieldRef<Enemy, float> DisableChaseTimer = AccessTools.FieldRefAccess<Enemy, float>("DisableChaseTimer"); private static readonly FieldRef<EnemyStateChase, float> ChaseStateTimer = AccessTools.FieldRefAccess<EnemyStateChase, float>("StateTimer"); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, Enemy enemy) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Invalid comparison between Unknown and I4 //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected I4, but got Unknown //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_00bb: Unknown result type (might be due to invalid IL or missing references) DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); if ((int)enemy.CurrentState == 8) { enemy.CurrentState = (EnemyState)3; } else if ((int)enemy.CurrentState == 4 && dedicatedEnemyRuntimeState.PreviousState != 4 && (Object)(object)GameFieldAccess.StateChase(enemy) != (Object)null) { EnemyStateChase val = GameFieldAccess.StateChase(enemy); ChaseStateTimer.Invoke(val) = Mathf.Max(ChaseStateTimer.Invoke(val), 10f); } else if (dedicatedEnemyRuntimeState.PreviousState == 4 && (int)enemy.CurrentState == 5 && !dedicatedEnemyRuntimeState.ExtraActionUsed) { PlayerAvatar val2 = GameFieldAccess.TargetPlayer(enemy); if (DedicatedBehaviorSupport.IsValidTarget(val2) && Vector3.Distance(((Component)enemy).transform.position, ((Component)val2).transform.position) <= 30f) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; enemy.CurrentState = (EnemyState)3; } } EnemyState currentState = enemy.CurrentState; if (((int)currentState == 2 || (int)currentState == 7) ? true : false) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.Countdown<Enemy>(enemy, DisableChaseTimer, DedicatedBehaviorSupport.CooldownRate(state)); DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)enemy.CurrentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(Enemy), "Update")] private static void UpdatePostfix(Enemy __instance) { DedicatedBehaviorSupport.Run<Enemy>(__instance, EliteArchetype.Headman, (Action<EliteState, Enemy>)Tick); } } [HarmonyPatch] internal static class HeadgrabElitePatches { private static readonly FieldRef<EnemyHeadGrabber, PlayerDeathHead> HeadTarget = AccessTools.FieldRefAccess<EnemyHeadGrabber, PlayerDeathHead>("headTarget"); private static readonly Action<EnemyHeadGrabber, PlayerDeathHead> UpdateHeadTarget = AccessTools.MethodDelegate<Action<EnemyHeadGrabber, PlayerDeathHead>>(AccessTools.Method(typeof(EnemyHeadGrabber), "UpdateHeadTarget", (Type[])null, (Type[])null), (object)null, true); private static readonly Action<EnemyHeadGrabber, State> UpdateState = AccessTools.MethodDelegate<Action<EnemyHeadGrabber, State>>(AccessTools.Method(typeof(EnemyHeadGrabber), "UpdateState", (Type[])null, (Type[])null), (object)null, true); private static readonly FieldRef<EnemyHeadGrabber, float> StateTimer = AccessTools.FieldRefAccess<EnemyHeadGrabber, float>("stateTimer"); private static readonly FieldRef<EnemyHeadGrabber, float> AttackCooldown = AccessTools.FieldRefAccess<EnemyHeadGrabber, float>("attackCooldown"); private static readonly FieldRef<EnemyHeadGrabber, float> HeadTargetCooldown = AccessTools.FieldRefAccess<EnemyHeadGrabber, float>("headTargetCooldown"); private static readonly FieldRef<EnemyHeadGrabber, int> AttacksInRow = AccessTools.FieldRefAccess<EnemyHeadGrabber, int>("attacksInRow"); private static readonly FieldRef<EnemyHeadGrabber, bool> HeadTargetActive = AccessTools.FieldRefAccess<EnemyHeadGrabber, bool>("headTargetActive"); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyHeadGrabber enemy) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Invalid comparison between Unknown and I4 //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected I4, but got Unknown DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); RecoverDroppedHead(state, enemy, dedicatedEnemyRuntimeState.Tactics); if ((int)enemy.currentState == 7) { DedicatedBehaviorSupport.Countdown<EnemyHeadGrabber>(enemy, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } float rate = DedicatedBehaviorSupport.CooldownRate(state); DedicatedBehaviorSupport.Countdown<EnemyHeadGrabber>(enemy, AttackCooldown, rate); DedicatedBehaviorSupport.Countdown<EnemyHeadGrabber>(enemy, HeadTargetCooldown, rate); if ((int)enemy.currentState == 8 && !HeadTargetActive.Invoke(enemy) && AttacksInRow.Invoke(enemy) > 3 && StateTimer.Invoke(enemy) <= Time.deltaTime * 2f && !dedicatedEnemyRuntimeState.ExtraActionUsed) { dedicatedEnemyRuntimeState.ExtraActionUsed = true; AttacksInRow.Invoke(enemy) = 3; } if ((int)enemy.currentState == 7 && dedicatedEnemyRuntimeState.PreviousState != 7) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)enemy.currentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeadGrabber), "Update")] private static void UpdatePostfix(EnemyHeadGrabber __instance) { DedicatedBehaviorSupport.Run<EnemyHeadGrabber>(__instance, EliteArchetype.Headgrab, (Action<EliteState, EnemyHeadGrabber>)Tick); } private static void CancelRecovery(EnemyHeadGrabber enemy, TacticalRuntimeState tactics) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 bool num = tactics.RecoveringHead && (Object)(object)HeadTarget.Invoke(enemy) == (Object)(object)tactics.RecoveryHead && !HeadTargetActive.Invoke(enemy); tactics.RecoveryHead = null; tactics.RecoveringHead = false; bool flag = num; if (flag) { State currentState = enemy.currentState; bool flag2 = ((currentState - 12 <= 1 || (int)currentState == 15) ? true : false); flag = flag2; } if (flag) { UpdateState(enemy, (State)1); HeadTarget.Invoke(enemy) = null; } } private static void RecoverDroppedHead(EliteState state, EnemyHeadGrabber enemy, TacticalRuntimeState tactics) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_008e: 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) if (!TacticalPositioning.IsActive((Component)(object)enemy, out EliteState _) || (Object)(object)tactics.RecoveryHead == (Object)null) { return; } if (HeadTargetActive.Invoke(enemy)) { tactics.RecoveryHead = null; tactics.RecoveringHead = false; return; } if (!TacticalPositioning.RecoverableHead(tactics)) { CancelRecovery(enemy, tactics); return; } State currentState; if (tactics.RecoveringHead) { currentState = enemy.currentState; if (currentState - 12 > 3) { CancelRecovery(enemy, tactics); } return; } currentState = enemy.currentState; if (((int)currentState == 1 || currentState - 3 <= 1) ? true : false) { if (!TacticalPositioning.TryPath(((Component)enemy).transform.position, ((Component)tactics.RecoveryHead).transform.position, 10f, out Vector3 _, out NavMeshPath _)) { CancelRecovery(enemy, tactics); return; } tactics.RecoveringHead = true; tactics.RecoveryDeadline = Time.time + 5f; UpdateHeadTarget(enemy, tactics.RecoveryHead); UpdateState(enemy, (State)12); } } [HarmonyPrefix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeadGrabber), "DeathHeadRelease")] private static void ReleaseHeadPrefix(EnemyHeadGrabber __instance) { DedicatedBehaviorSupport.Run<EnemyHeadGrabber>(__instance, EliteArchetype.Headgrab, (Action<EliteState, EnemyHeadGrabber>)delegate(EliteState state, EnemyHeadGrabber enemy) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (TacticalPositioning.IsActive((Component)(object)enemy, out EliteState _) && (int)enemy.currentState == 18 && HeadTargetActive.Invoke(enemy) && (Object)(object)HeadTarget.Invoke(enemy) != (Object)null) { DedicatedBehaviorSupport.Runtime(state).Tactics.RememberDroppedHead(HeadTarget.Invoke(enemy), enemy.headTargetPositionReleaseTransform.position); } }); } [HarmonyPrefix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeadGrabber), "StateGotoHead")] private static bool RecoverHeadPrefix(EnemyHeadGrabber __instance) { bool runOriginal = true; DedicatedBehaviorSupport.Run<EnemyHeadGrabber>(__instance, EliteArchetype.Headgrab, (Action<EliteState, EnemyHeadGrabber>)delegate(EliteState state, EnemyHeadGrabber enemy) { TacticalRuntimeState tactics = DedicatedBehaviorSupport.Runtime(state).Tactics; if (TacticalPositioning.IsActive((Component)(object)enemy, out EliteState _) && tactics.RecoveringHead && !HeadTargetActive.Invoke(enemy) && !TacticalPositioning.RecoverableHead(tactics)) { CancelRecovery(enemy, tactics); runOriginal = false; } }); return runOriginal; } [HarmonyPrefix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeadGrabber), "StateGotoHeadOver")] private static bool RecoverHeadOverPrefix(EnemyHeadGrabber __instance) { return RecoverHeadPrefix(__instance); } [HarmonyPrefix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeadGrabber), "StateGrabHead")] private static bool GrabRecoveredHeadPrefix(EnemyHeadGrabber __instance) { return RecoverHeadPrefix(__instance); } } [HarmonyPatch] internal static class HeartHuggerElitePatches { private static readonly FieldRef<EnemyHeartHugger, PlayerAvatar> CurrentTarget = AccessTools.FieldRefAccess<EnemyHeartHugger, PlayerAvatar>("currentTarget"); private static readonly FieldRef<EnemyHeartHugger, List<LevelPoint>> LevelPoints = AccessTools.FieldRefAccess<EnemyHeartHugger, List<LevelPoint>>("levelPoints"); private static readonly FieldRef<EnemyHeartHugger, bool> DoLeave = AccessTools.FieldRefAccess<EnemyHeartHugger, bool>("doLeave"); private static readonly FieldRef<EnemyHeartHugger, bool> DoDespawn = AccessTools.FieldRefAccess<EnemyHeartHugger, bool>("doDespawn"); private static readonly FieldRef<EnemyHeartHugger, float> StateTimer = AccessTools.FieldRefAccess<EnemyHeartHugger, float>("stateTimer"); private static readonly FieldRef<EnemyHeartHugger, int> AttacksInRow = AccessTools.FieldRefAccess<EnemyHeartHugger, int>("attacksInARow"); private static readonly Action<EnemyHeartHugger, State> StateSet = AccessTools.MethodDelegate<Action<EnemyHeartHugger, State>>(AccessTools.Method(typeof(EnemyHeartHugger), "StateSet", (Type[])null, (Type[])null), (object)null, true); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyHeartHugger enemy) { //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) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 State currentState = enemy.currentState; if (((int)currentState == 4 || (int)currentState == 6 || (int)currentState == 9) ? true : false) { DedicatedBehaviorSupport.Countup<EnemyHeartHugger>(enemy, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } } [HarmonyPrefix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeartHugger), "LeaveStart")] private static bool LeaveStartPrefix(EnemyHeartHugger __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 if (!SemiFunc.IsMasterClientOrSingleplayer() || !EliteRegistry.TryGet((Component?)(object)__instance, out EliteState state)) { return true; } DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); if ((int)__instance.currentState != 10 || dedicatedEnemyRuntimeState.ExtraActionUsed) { return true; } dedicatedEnemyRuntimeState.ExtraActionUsed = true; AttacksInRow.Invoke(__instance) = 0; StateSet(__instance, (State)5); return false; } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeartHugger), "Update")] private static void UpdatePostfix(EnemyHeartHugger __instance) { DedicatedBehaviorSupport.Run<EnemyHeartHugger>(__instance, EliteArchetype.HeartHugger, (Action<EliteState, EnemyHeartHugger>)Tick); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeartHugger), "OnVision")] private static void OnVisionPostfix(EnemyHeartHugger __instance) { DedicatedBehaviorSupport.Run<EnemyHeartHugger>(__instance, EliteArchetype.HeartHugger, (Action<EliteState, EnemyHeartHugger>)delegate(EliteState state, EnemyHeartHugger enemy) { PlayerAvatar val = CurrentTarget.Invoke(enemy); if (TacticalPositioning.IsActive((Component)(object)enemy, out EliteState _) && TacticalPositioning.VisiblePlayer(state.Enemy, val)) { TacticalPositioning.RememberSeenPlayer(DedicatedBehaviorSupport.Runtime(state).Tactics, val); } }); } [HarmonyPrefix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHeartHugger), "SetPositionToRandomLevelPoint")] private static void ChoosePositionPrefix(EnemyHeartHugger __instance) { DedicatedBehaviorSupport.Run<EnemyHeartHugger>(__instance, EliteArchetype.HeartHugger, (Action<EliteState, EnemyHeartHugger>)delegate(EliteState state, EnemyHeartHugger enemy) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 bool flag = DoLeave.Invoke(enemy) || DoDespawn.Invoke(enemy); if (!flag) { State currentState = enemy.currentState; bool flag2 = (((int)currentState == 3 || (int)currentState == 13) ? true : false); flag = !flag2; } if (!flag) { TacticalRuntimeState tactics = DedicatedBehaviorSupport.Runtime(state).Tactics; List<LevelPoint> list = LevelPoints.Invoke(enemy); if (list != null && TacticalPositioning.AmbushExit(state, tactics, list, out LevelPoint chosen)) { LevelPoints.Invoke(enemy) = new List<LevelPoint> { chosen }; tactics.HasSeenPlayer = false; } } }); } } [HarmonyPatch] internal static class HiddenElitePatches { private static readonly FieldRef<EnemyHidden, float> StateTimer = AccessTools.FieldRefAccess<EnemyHidden, float>("stateTimer"); private static readonly FieldRef<EnemyHidden, float> MaxMoveTimer = AccessTools.FieldRefAccess<EnemyHidden, float>("maxMoveTimer"); private static readonly FieldRef<EnemyHidden, Vector3> AgentDestination = AccessTools.FieldRefAccess<EnemyHidden, Vector3>("agentDestination"); private static readonly FieldRef<EnemyHidden, PlayerAvatar> PlayerTarget = AccessTools.FieldRefAccess<EnemyHidden, PlayerAvatar>("playerTarget"); internal static void OnSpawn(EliteState state) { DedicatedBehaviorSupport.OnSpawn(state); } private static void Tick(EliteState state, EnemyHidden enemy) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Invalid comparison between Unknown and I4 //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected I4, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ae: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) DedicatedEnemyRuntimeState dedicatedEnemyRuntimeState = DedicatedBehaviorSupport.Runtime(state); State currentState = enemy.currentState; if (((int)currentState == 4 || (int)currentState == 6 || (int)currentState == 9) ? true : false) { DedicatedBehaviorSupport.Countdown<EnemyHidden>(enemy, StateTimer, DedicatedBehaviorSupport.WindupRate(state)); } if ((int)enemy.currentState == 7) { if (dedicatedEnemyRuntimeState.PreviousState != 7) { dedicatedEnemyRuntimeState.Tactics.RescueEvaded = false; dedicatedEnemyRuntimeState.Tactics.NextScanAt = 0f; } if (TacticalPositioning.EvadeRescuer(state, PlayerTarget.Invoke(enemy), AgentDestination.Invoke(enemy), dedicatedEnemyRuntimeState.Tactics, out var point)) { AgentDestination.Invoke(enemy) = point; GameFieldAccess.NavMeshAgent(state.Enemy).SetDestination(point); } DedicatedBehaviorSupport.RetainCountdown<EnemyHidden>(enemy, MaxMoveTimer, DedicatedBehaviorSupport.Retention(state)); float num = Vector3.Distance(dedicatedEnemyRuntimeState.LastPosition, ((Component)enemy).transform.position); dedicatedEnemyRuntimeState.StuckTimer = ((num < 0.05f) ? (dedicatedEnemyRuntimeState.StuckTimer + Time.deltaTime) : 0f); dedicatedEnemyRuntimeState.LastPosition = ((Component)enemy).transform.position; if (dedicatedEnemyRuntimeState.StuckTimer >= 1.5f && !dedicatedEnemyRuntimeState.ExtraActionUsed) { LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)enemy).transform.position, 20f, 80f, false); NavMeshHit val2 = default(NavMeshHit); if ((Object)(object)val != (Object)null && NavMesh.SamplePosition(((Component)val).transform.position, ref val2, 5f, -1)) { AgentDestination.Invoke(enemy) = ((NavMeshHit)(ref val2)).position; GameFieldAccess.NavMeshAgent(state.Enemy).SetDestination(((NavMeshHit)(ref val2)).position); dedicatedEnemyRuntimeState.ExtraActionUsed = true; } dedicatedEnemyRuntimeState.StuckTimer = 0f; } } else { dedicatedEnemyRuntimeState.StuckTimer = 0f; dedicatedEnemyRuntimeState.LastPosition = ((Component)enemy).transform.position; } if ((int)enemy.currentState == 4 && dedicatedEnemyRuntimeState.PreviousState != 4) { dedicatedEnemyRuntimeState.ExtraActionUsed = false; } DedicatedBehaviorSupport.TrackState(dedicatedEnemyRuntimeState, (int)enemy.currentState); } [HarmonyPostfix] [HarmonyAfter(new string[] { "REPOJP.StagePhysicsEvents", "REPOJP.RoleShuffle" })] [HarmonyPatch(typeof(EnemyHidden), "Update")] private static void UpdatePostfix(EnemyHidden __instance) {