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 King Of The Coral Kin v1.0.4
KOTCKFIX.dll
Decompiled 5 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using Microsoft.CodeAnalysis; using Silksong.FsmUtil; using TeamCherry.Localization; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("KOTCKFIX")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("KOTCKFIX")] [assembly: AssemblyTitle("KOTCKFIX")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/astrum-nova/KOTCKFIX")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace KingOfTheCoralKin { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("io.github.kingofthecoralkin", "KOTCKFIX", "0.1.0")] public class KingOfTheCoralKinPlugin : BaseUnityPlugin { private static class SpikePools { private static readonly List<GameObject> longSpear = new List<GameObject>(); private static readonly List<GameObject> uppercutSpear = new List<GameObject>(); private static readonly List<GameObject> airSpear = new List<GameObject>(); public static List<GameObject> getReleveantPool() { CoralSpikeState coralSpikeFSMState = KingOfTheCoralKinPlugin.coralSpikeFSMState; if (1 == 0) { } List<GameObject> result = coralSpikeFSMState switch { CoralSpikeState.UPPERCUT => uppercutSpear, CoralSpikeState.JAB => longSpear, CoralSpikeState.AIRJAB => airSpear, _ => null, }; if (1 == 0) { } return result; } public static void resetPools() { longSpear.Clear(); uppercutSpear.Clear(); airSpear.Clear(); } } private enum CoralSpikeState { UPPERCUT, JAB, AIRJAB } [CompilerGenerated] private sealed class <>c__DisplayClass30_0 { public string eventName; internal bool <ForceNextState>b__0(FsmTransition t) { return t.EventName == eventName; } } [CompilerGenerated] private sealed class <DisableClone>d__28 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject clone; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DisableClone>d__28(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; clone.SetActive(false); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DisableCrossCooldown>d__33 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DisableCrossCooldown>d__33(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; crossCooldown = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DisableCrossed>d__32 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DisableCrossed>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; crossed = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DisableScheduledCoralRain>d__35 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DisableScheduledCoralRain>d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; scheduledCoralRain = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DisableThreeSpiked>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DisableThreeSpiked>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; threeSpiked = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FadeTeleport>d__29 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeTeleport>d__29(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; GameCameras.instance.cameraFadeFSM.SetState("Scene Fade Out"); <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; GameCameras.instance.cameraFadeFSM.SetState("Scene Fade In"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ForceNextState>d__30 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FsmState state; public string eventName; public float delay; private <>c__DisplayClass30_0 <>8__1; private FsmTransition <transition>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ForceNextState>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <transition>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass30_0(); <>8__1.eventName = eventName; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; <transition>5__2 = ((IEnumerable<FsmTransition>)state.Transitions).FirstOrDefault((Func<FsmTransition, bool>)((FsmTransition t) => t.EventName == <>8__1.eventName)); if (<transition>5__2 != null) { state.Fsm.SetState(<transition>5__2.ToState); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ScheduleNextState>d__31 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string stateName; public float duration; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ScheduleNextState>d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; bossControlFSM.SetState(stateName); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SpawnSpike>d__27 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject go; public int distance; public Vector3 direction; public float delay; private GameObject <clone>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnSpike>d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <clone>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00a0: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; <clone>5__1 = GetNewSpike(go); <clone>5__1.transform.position = go.transform.position + direction * (float)distance; <clone>5__1.transform.rotation = go.transform.rotation; <clone>5__1.transform.localScale = go.transform.localScale; if (coralSpikeFSMState == CoralSpikeState.JAB) { Extensions.FlipLocalScale(<clone>5__1.transform, true, false, false); <clone>5__1.transform.position = new Vector3((<clone>5__1.transform.position.x > 50f) ? 16.57f : 94.27f, <clone>5__1.transform.position.y, <clone>5__1.transform.position.z); } <clone>5__1.SetActive(true); ((MonoBehaviour)Instance).StartCoroutine(DisableClone(<clone>5__1)); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <Start>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public KingOfTheCoralKinPlugin <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Start>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; Harmony.CreateAndPatchAll(typeof(Language_Get_Patch), (string)null); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool inCoralMemory; private static bool teleportToBoss; private static bool disableContactDamage; private static HeroController? hornet; private static PlayMakerFSM? bossControlFSM; private static CoralSpikeState coralSpikeFSMState; private static bool P2; private static bool P3; private static bool scheduledCoralRain; private static int groundHits; private static bool crossed; private static bool threeSpiked; private static bool crossCooldown; public const string Id = "io.github.kingofthecoralkin"; private static KingOfTheCoralKinPlugin Instance { get; set; } public static string Name => "KOTCKFIX"; public static string Version => "0.1.0"; private void Awake() { Instance = this; teleportToBoss = ((BaseUnityPlugin)this).Config.Bind<bool>("King Of The Coral Kin", "TeleportOnSuperDash", true, "If true, the silksoar will take hornet directly up to the boss, skipping everything else").Value; disableContactDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("King Of The Coral Kin", "DisableContactDamage", true, "If true, the boss contact damage will be disabled").Value; Harmony.CreateAndPatchAll(typeof(KingOfTheCoralKinPlugin), (string)null); SceneManager.sceneLoaded += sceneLoadSetup; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.kingofthecoralkin) has loaded!")); } private void FixedUpdate() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (inCoralMemory && hornet.cState.superDashing && teleportToBoss) { string activeStateName = GameCameras.instance.cameraFadeFSM.ActiveStateName; if ((!(activeStateName == "Scene Fade Out") && !(activeStateName == "Scene Fade In")) || 1 == 0) { ((MonoBehaviour)Instance).StartCoroutine(FadeTeleport()); } float y = hornet.transform.position.y; if (y > 40f && y < 50f) { hornet.transform.position = new Vector3(55.2f, 500f, 0.004f); } } } [IteratorStateMachine(typeof(<Start>d__21))] public IEnumerator Start() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Start>d__21(0) { <>4__this = this }; } [HarmonyPatch(typeof(ActivateGameObject), "OnEnter")] private static void Postfix(ActivateGameObject __instance) { //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0241: 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_0327: 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) //IL_00e9: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) if (!inCoralMemory || (Object)(object)__instance.activatedGameObject == (Object)null) { return; } GameObject activatedGameObject = __instance.activatedGameObject; if (!((Object)activatedGameObject).name.StartsWith("Coral_spear_long")) { return; } switch (coralSpikeFSMState) { case CoralSpikeState.UPPERCUT: ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, P2 ? 8 : 10, Vector3.right, 0.05f)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, P2 ? (-8) : (-10), Vector3.right, 0.05f)); if (P2) { ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, 16, Vector3.right, 0.2f)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, -16, Vector3.right, 0.2f)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, 24, Vector3.right, 0.3f)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, -24, Vector3.right, 0.3f)); } if (P3 && !threeSpiked) { threeSpiked = true; ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, Extensions.GetRandomElement<int>(new int[2] { 4, -4 }), Vector3.right, 0.1f)); ((MonoBehaviour)Instance).StartCoroutine(DisableThreeSpiked()); } break; case CoralSpikeState.JAB: { GameObject newSpike2 = GetNewSpike(activatedGameObject); newSpike2.transform.position = activatedGameObject.transform.position; newSpike2.transform.rotation = activatedGameObject.transform.rotation; newSpike2.transform.localScale = activatedGameObject.transform.localScale; newSpike2.SetActive(true); ((MonoBehaviour)Instance).StartCoroutine(DisableClone(newSpike2)); activatedGameObject.SetActive(false); if (!crossed) { ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, P2 ? Extensions.GetRandomElement<int>(new int[2] { 4, 8 }) : 8, Vector3.up, 0.1f)); } else { crossed = false; ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, 8, Vector3.up, 0.1f)); } break; } case CoralSpikeState.AIRJAB: { GameObject newSpike = GetNewSpike(activatedGameObject); newSpike.transform.position = activatedGameObject.transform.position; newSpike.transform.rotation = activatedGameObject.transform.rotation; newSpike.transform.localScale = activatedGameObject.transform.localScale; newSpike.SetActive(true); ((MonoBehaviour)Instance).StartCoroutine(DisableClone(newSpike)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, P2 ? 11 : 12, Vector3.right, 0.05f)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, P2 ? (-11) : (-12), Vector3.right, 0.05f)); if (P2) { ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, 22, Vector3.right, 0.2f)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, -22, Vector3.right, 0.2f)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, 33, Vector3.right, 0.3f)); ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, -33, Vector3.right, 0.3f)); } if (P3) { ((MonoBehaviour)Instance).StartCoroutine(SpawnSpike(activatedGameObject, Extensions.GetRandomElement<int>(new int[2] { 5, -5 }), Vector3.right, 0.1f)); } break; } } } [HarmonyPostfix] [HarmonyPatch(typeof(FsmState), "OnEnter")] private static void OnFsmStateEntered(FsmState __instance) { //IL_061a: Unknown result type (might be due to invalid IL or missing references) if (!inCoralMemory) { return; } switch (__instance.name) { case "Drop In": bossControlFSM = __instance.Fsm.FsmComponent; if (disableContactDamage) { DamageHero[] componentsInChildren = ((Component)bossControlFSM).gameObject.GetComponentsInChildren<DamageHero>(true); foreach (DamageHero val2 in componentsInChildren) { Object.Destroy((Object)(object)val2); } } setupBossValues(); P2 = (P3 = false); scheduledCoralRain = false; groundHits = 0; SpikePools.resetPools(); break; case "Hornet Dead": P2 = (P3 = false); scheduledCoralRain = false; groundHits = 0; crossed = false; SpikePools.resetPools(); break; case "Death Stagger": inCoralMemory = false; P2 = (P3 = false); scheduledCoralRain = false; groundHits = 0; crossed = false; SpikePools.resetPools(); ((MonoBehaviour)Instance).StopAllCoroutines(); break; case "P2": if (!P2) { P2 = true; ((MonoBehaviour)Instance).StartCoroutine(ForceNextState(__instance, "PHASE ROAR", 0f)); } break; case "P3": if (!P3) { P3 = true; ((MonoBehaviour)Instance).StartCoroutine(ForceNextState(__instance, "PHASE ROAR", 0f)); } break; case "P3 Roar": ((MonoBehaviour)Instance).StartCoroutine(ScheduleNextState(Extensions.GetRandomElement<string>(new string[4] { "UC Antic", "Air Jab Aim", "Cross Antic", "Jab Dir" }), 1f)); break; case "UC Antic": if (coralSpikeFSMState == CoralSpikeState.UPPERCUT) { bossControlFSM.SetState("Air Jab Aim"); } else { coralSpikeFSMState = CoralSpikeState.UPPERCUT; } break; case "Jab Antic": if (coralSpikeFSMState == CoralSpikeState.JAB) { bossControlFSM.SetState(Extensions.GetRandomElement<string>(new string[3] { "Cross Antic", "Air Jab Aim", "UC Antic" })); } else { coralSpikeFSMState = CoralSpikeState.JAB; } break; case "Air Jab Antic": coralSpikeFSMState = CoralSpikeState.AIRJAB; break; case "Cross 2": crossed = true; crossCooldown = true; ((MonoBehaviour)Instance).StartCoroutine(DisableCrossed()); ((MonoBehaviour)Instance).StartCoroutine(DisableCrossCooldown()); ((MonoBehaviour)Instance).StartCoroutine(ForceNextState(__instance, "CROSS CHOP", 0.05f)); break; case "Cross Antic": if (crossCooldown) { PlayMakerFSM val = bossControlFSM; CoralSpikeState coralSpikeState = coralSpikeFSMState; if (1 == 0) { } string state = coralSpikeState switch { CoralSpikeState.UPPERCUT => (Random.value < 0.5f) ? "Air Jab Aim" : "Jab Dir", CoralSpikeState.JAB => (Random.value < 0.5f) ? "Air Jab Aim" : "UC Antic", CoralSpikeState.AIRJAB => (Random.value < 0.5f) ? "UC Antic" : "Jab Dir", _ => null, }; if (1 == 0) { } val.SetState(state); crossCooldown = false; } break; case "Ground Hit": if (groundHits >= 2) { groundHits = 0; } else { ((MonoBehaviour)Instance).StartCoroutine(ScheduleNextState("Ground Hit", 0.35f)); } groundHits++; break; case "Shoot Pos": case "Shoot Antic": bossControlFSM.SetState("P3"); break; case "Antic": { if (!((Object)__instance.Fsm.FsmComponent).name.StartsWith("Coral Spike")) { break; } PlayMakerFSM fsmComponent = __instance.Fsm.FsmComponent; if (P3) { ((MonoBehaviour)Instance).StartCoroutine(ScheduleNextState("Air Jab Aim", 1.2f)); if (((Component)fsmComponent).transform.position.y > 557f) { Object.Destroy((Object)(object)((Component)fsmComponent).gameObject); } if (!scheduledCoralRain) { scheduledCoralRain = true; ((MonoBehaviour)Instance).StartCoroutine(ScheduleNextState("Ground Hit", 0.2f)); ((MonoBehaviour)Instance).StartCoroutine(DisableScheduledCoralRain()); } } break; } } } private static void sceneLoadSetup(Scene scene, LoadSceneMode mode) { if (((Scene)(ref scene)).name != "Memory_Coral_Tower") { inCoralMemory = false; return; } inCoralMemory = true; hornet = HeroController.instance; PlayerData.instance.encounteredCoralKing = true; } private static GameObject GetNewSpike(GameObject go) { List<GameObject> releveantPool = SpikePools.getReleveantPool(); GameObject val = null; bool flag = false; for (int i = 0; i < releveantPool.Count; i++) { if (!releveantPool[i].activeSelf) { val = releveantPool[i]; flag = true; break; } } if (!flag) { val = Object.Instantiate<GameObject>(go, go.transform.parent); GameObject obj = val; ((Object)obj).name = ((Object)obj).name + "_POOLED"; releveantPool.Add(val); } return val; } private static void setupBossValues() { Object.Destroy((Object)(object)FSMUtility.LocateMyFSM(((Component)bossControlFSM).gameObject, "Stun Control")); FsmUtil.GetFirstActionOfType<SetFloatValue>(bossControlFSM, "P1").floatVariable = FsmFloat.op_Implicit(0f); FsmUtil.GetFirstActionOfType<SetFloatValue>(bossControlFSM, "P1").floatValue = FsmFloat.op_Implicit(0f); FsmUtil.GetFirstActionOfType<SetFloatValue>(bossControlFSM, "P2").floatVariable = FsmFloat.op_Implicit(0f); FsmUtil.GetFirstActionOfType<SetFloatValue>(bossControlFSM, "P2").floatValue = FsmFloat.op_Implicit(0f); FsmUtil.GetFirstActionOfType<SetFloatValue>(bossControlFSM, "P3").floatVariable = FsmFloat.op_Implicit(0f); FsmUtil.GetFirstActionOfType<SetFloatValue>(bossControlFSM, "P3").floatValue = FsmFloat.op_Implicit(0f); FsmUtil.GetFirstActionOfType<FloatOperator>(bossControlFSM, "Roar Recover").float1 = FsmFloat.op_Implicit(0.5f); FsmUtil.GetFirstActionOfType<Wait>(bossControlFSM, "Jab 2").time = FsmFloat.op_Implicit(0.5f); FsmUtil.GetFirstActionOfType<Wait>(bossControlFSM, "Uppercut 2").time = FsmFloat.op_Implicit(0.5f); FsmUtil.GetFirstActionOfType<Wait>(bossControlFSM, "Cross 2").time = FsmFloat.op_Implicit(0.5f); FsmUtil.GetFirstActionOfType<Wait>(bossControlFSM, "Air Jab 2").time = FsmFloat.op_Implicit(0.5f); FsmUtil.GetFirstActionOfType<Wait>(bossControlFSM, "Cross Followup 2").time = FsmFloat.op_Implicit(0.5f); FsmUtil.GetFirstActionOfType<Wait>(bossControlFSM, "Ground Hit").time = FsmFloat.op_Implicit(0.5f); FsmUtil.GetLastActionOfType<Wait>(bossControlFSM, "Ground Hit").time = FsmFloat.op_Implicit(0.5f); FsmUtil.GetFirstActionOfType<Wait>(bossControlFSM, "Followup Pause").time = FsmFloat.op_Implicit(0f); } [IteratorStateMachine(typeof(<SpawnSpike>d__27))] private static IEnumerator SpawnSpike(GameObject go, int distance, Vector3 direction, float delay) { //IL_0015: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpawnSpike>d__27(0) { go = go, distance = distance, direction = direction, delay = delay }; } [IteratorStateMachine(typeof(<DisableClone>d__28))] private static IEnumerator DisableClone(GameObject clone) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DisableClone>d__28(0) { clone = clone }; } [IteratorStateMachine(typeof(<FadeTeleport>d__29))] private static IEnumerator FadeTeleport() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeTeleport>d__29(0); } [IteratorStateMachine(typeof(<ForceNextState>d__30))] private static IEnumerator ForceNextState(FsmState state, string eventName, float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ForceNextState>d__30(0) { state = state, eventName = eventName, delay = delay }; } [IteratorStateMachine(typeof(<ScheduleNextState>d__31))] private static IEnumerator ScheduleNextState(string stateName, float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ScheduleNextState>d__31(0) { stateName = stateName, duration = duration }; } [IteratorStateMachine(typeof(<DisableCrossed>d__32))] private static IEnumerator DisableCrossed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DisableCrossed>d__32(0); } [IteratorStateMachine(typeof(<DisableCrossCooldown>d__33))] private static IEnumerator DisableCrossCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DisableCrossCooldown>d__33(0); } [IteratorStateMachine(typeof(<DisableThreeSpiked>d__34))] private static IEnumerator DisableThreeSpiked() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DisableThreeSpiked>d__34(0); } [IteratorStateMachine(typeof(<DisableScheduledCoralRain>d__35))] private static IEnumerator DisableScheduledCoralRain() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DisableScheduledCoralRain>d__35(0); } } [HarmonyPatch(typeof(Language), "Get")] [HarmonyPatch(new Type[] { typeof(string), typeof(string) })] public static class Language_Get_Patch { private static void Postfix(string key, string sheetTitle, ref string __result) { if (key == "CORAL_KING_SUPER") { __result = "King Of The"; } if (key == "CORAL_KING_MAIN") { __result = "Coral Kin"; } } } }