Decompiled source of Revolt And Devotion v1.0.2

RevoltAndDevotion.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Microsoft.CodeAnalysis;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
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("RevoltAndDevotion")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+0b02b220e8a6b8ef4a44144904b6da7a1ded914c")]
[assembly: AssemblyProduct("RevoltAndDevotion")]
[assembly: AssemblyTitle("RevoltAndDevotion")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/astrum-nova/RevoltAndDevotion")]
[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;
		}
	}
}
internal static class WidowSceneLoader
{
	private static readonly string sceneFolder;

	private static readonly string bellsFolder;

	private static AssetBundle? sceneBundle;

	private static bool loadedAssets;

	public static async Task<GameObject> LoadWidowIntoScene(string sourceScene, Scene targetScene)
	{
		//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)
		if ((Object)(object)sceneBundle != (Object)null)
		{
			sceneBundle.Unload(true);
		}
		sceneBundle = null;
		sceneBundle = AssetBundle.LoadFromFile(Path.Combine(sceneFolder, (sourceScene + ".bundle").ToLower()));
		LoadAsset("atlases_assets_assets\\sprites\\_atlases\\spinner_thread_pull.spriteatlas.bundle");
		LoadAsset("materials_assets_areabell.bundle");
		LoadAsset("tk2dcollections_assets_areabell.bundle");
		LoadAsset("localpoolprefabs_assets_areabell.bundle");
		LoadAsset("enemycorpses_assets_areabell.bundle");
		LoadAsset("tk2danimations_assets_areabell.bundle");
		LoadAsset("fsmtemplates_assets_areabell.bundle");
		LoadAsset("animations_assets_areabell.bundle");
		LoadAsset("textures_assets_areabell.bundle");
		LoadAsset("sfxdynamic_assets_areabell.bundle");
		LoadAsset("audiocuesdynamic_assets_areabell.bundle");
		LoadAsset("sfxstatic_assets_areabell.bundle");
		LoadAsset("audiocuesstatic_assets_areabell.bundle");
		if (!loadedAssets)
		{
			new Hook((MethodBase)typeof(AssetBundle).GetMethod("UnloadAsync"), (Delegate)(Func<Func<AssetBundle, bool, AssetBundleUnloadOperation>, AssetBundle, bool, AssetBundleUnloadOperation>)((Func<AssetBundle, bool, AssetBundleUnloadOperation> orig, AssetBundle self, bool _) => orig.Invoke(self, false)));
			loadedAssets = true;
		}
		Awaiter val = AsyncOperationAwaitableExtensions.GetAwaiter(SceneManager.LoadSceneAsync(sourceScene, (LoadSceneMode)1));
		Awaiter val2 = default(Awaiter);
		if (!((Awaiter)(ref val)).IsCompleted)
		{
			await val;
			val = val2;
			val2 = default(Awaiter);
		}
		((Awaiter)(ref val)).GetResult();
		Scene widowScene = SceneManager.GetSceneByName(sourceScene);
		GameObject widowClone = Object.Instantiate<GameObject>(FindGameObjectInChildren("Boss Scene", FindGameObjectInChildren("Normal World", ((IEnumerable<GameObject>)((Scene)(ref widowScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => ((Object)go).name == "Black Thread States Thread Only Variant")))));
		Object.Destroy((Object)(object)FindGameObjectInChildren("Gates", widowClone));
		Object.Destroy((Object)(object)FindGameObjectInChildren("CamLock B", widowClone));
		Object.Destroy((Object)(object)FindGameObjectInChildren("Intro Spinner", widowClone));
		Object.Destroy((Object)(object)FindGameObjectInChildren("Bell Bench", widowClone));
		Object.Destroy((Object)(object)FindGameObjectInChildren("Challenge Region", widowClone));
		Object.Destroy((Object)(object)FindGameObjectInChildren("Speak Region", widowClone));
		SceneManager.MoveGameObjectToScene(widowClone, targetScene);
		SceneManager.MoveGameObjectToScene(Object.Instantiate<GameObject>(((IEnumerable<GameObject>)((Scene)(ref widowScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => ((Object)go).name == "_Managers"))), targetScene);
		Awaiter val3 = AsyncOperationAwaitableExtensions.GetAwaiter(SceneManager.UnloadSceneAsync(sourceScene));
		if (!((Awaiter)(ref val3)).IsCompleted)
		{
			await val3;
			val3 = val2;
		}
		((Awaiter)(ref val3)).GetResult();
		return widowClone;
	}

	private static void LoadAsset(string assetPath)
	{
		AssetBundle.LoadFromFile(Path.Combine(bellsFolder, assetPath.ToLower()));
	}

	public static GameObject FindGameObjectInChildren(string gameObjectName, GameObject parent)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		GameObject result = null;
		foreach (Transform item in parent.transform)
		{
			Transform val = item;
			if (((Object)((Component)val).gameObject).name == gameObjectName)
			{
				result = ((Component)val).gameObject;
			}
		}
		return result;
	}

	static WidowSceneLoader()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Invalid comparison between Unknown and I4
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Invalid comparison between Unknown and I4
		//IL_0063: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Invalid comparison between Unknown and I4
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Invalid comparison between Unknown and I4
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Invalid comparison between Unknown and I4
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Invalid comparison between Unknown and I4
		string streamingAssetsPath = Application.streamingAssetsPath;
		RuntimePlatform platform = Application.platform;
		if (1 == 0)
		{
		}
		string path = (((int)platform == 1) ? "StandaloneOSX" : (((int)platform == 2) ? "StandaloneWindows64" : (((int)platform != 13) ? "" : "StandaloneLinux64")));
		if (1 == 0)
		{
		}
		sceneFolder = Path.Combine(streamingAssetsPath, "aa", path, "scenes_scenes_scenes");
		string streamingAssetsPath2 = Application.streamingAssetsPath;
		RuntimePlatform platform2 = Application.platform;
		if (1 == 0)
		{
		}
		path = (((int)platform2 == 1) ? "StandaloneOSX" : (((int)platform2 == 2) ? "StandaloneWindows64" : (((int)platform2 != 13) ? "" : "StandaloneLinux64")));
		if (1 == 0)
		{
		}
		bellsFolder = Path.Combine(streamingAssetsPath2, "aa", path);
	}
}
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 RevoltAndDevotion
{
	public class BellStunner : MonoBehaviour
	{
		private bool deflected;

		private void OnTriggerEnter2D(Collider2D collision)
		{
			if (!RevoltAndDevotionPlugin.foundWidowControl || !RevoltAndDevotionPlugin.foundSinnerControl)
			{
				return;
			}
			bool flag;
			switch (RevoltAndDevotionPlugin.sinnerControl.ActiveStateName)
			{
			case "Death Stagger F":
			case "Death Stagger End":
			case "Set P2 Start":
				flag = true;
				break;
			default:
				flag = false;
				break;
			}
			if (!flag)
			{
				if (((Object)((Component)collision).gameObject).name.Contains("Slash"))
				{
					deflected = true;
				}
				if ((Object)(object)RevoltAndDevotionPlugin.sinnerControl != (Object)null && (Object)(object)((Component)collision).gameObject == (Object)(object)((Component)RevoltAndDevotionPlugin.sinnerControl).gameObject && deflected)
				{
					RevoltAndDevotionPlugin.sinnerControl.SetState("Bind Break");
					HealthManager component = ((Component)RevoltAndDevotionPlugin.sinnerControl).gameObject.GetComponent<HealthManager>();
					component.hp -= 30;
					deflected = false;
				}
			}
		}

		private void OnEnable()
		{
			deflected = false;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("io.github.astrum-nova.revoltanddevotion", "RevoltAndDevotion", "0.1.0")]
	public class RevoltAndDevotionPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <Start>d__19 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RevoltAndDevotionPlugin <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Start>d__19(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(TitleNamePatch), (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();
			}
		}

		[CompilerGenerated]
		private sealed class <StopWidowAfterDeath>d__30 : 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 <StopWidowAfterDeath>d__30(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: 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;
					widowControl.Fsm.manualUpdate = false;
					widowControl.SetState("Tele Out");
					<>2__current = (object)new WaitForSeconds(0.25f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					widowControl.Fsm.manualUpdate = true;
					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();
			}
		}

		public static bool foundWidowControl;

		public static bool foundSinnerControl;

		private static bool p2ForBoth;

		private static int lastSinnerHp;

		private static int PHASE_1_HP = 1300;

		private static int PHASE_2_HP = 1000;

		private static int PHASE_3_HP = 630;

		private const float WIDOW_GROUND = 18.5f;

		public static PlayMakerFSM widowControl;

		public static PlayMakerFSM sinnerControl;

		private static HealthManager widowHealthManager;

		private static HealthManager sinnerHealthManager;

		private static Transform? widowTransform;

		private static GameObject widowClone;

		public const string Id = "io.github.astrum-nova.revoltanddevotion";

		private static RevoltAndDevotionPlugin Instance { get; set; } = null;


		public static string Name => "RevoltAndDevotion";

		public static string Version => "0.1.0";

		private void Awake()
		{
			Instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.astrum-nova.revoltanddevotion) has loaded!"));
			PHASE_1_HP = ((BaseUnityPlugin)this).Config.Bind<int>("Revolt And Devotion", "Phase 1 HP", 1300, "Sets the starting HP").Value;
			PHASE_2_HP = ((BaseUnityPlugin)this).Config.Bind<int>("Revolt And Devotion", "Phase 2 HP", 1000, "Sets the HP where widow unlocks the mass bells attack").Value;
			PHASE_3_HP = ((BaseUnityPlugin)this).Config.Bind<int>("Revolt And Devotion", "Phase 3 HP", 630, "Sets the HP for phase 2").Value;
			Harmony.CreateAndPatchAll(typeof(RevoltAndDevotionPlugin), (string)null);
		}

		[IteratorStateMachine(typeof(<Start>d__19))]
		public IEnumerator Start()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Start>d__19(0)
			{
				<>4__this = this
			};
		}

		public void OnEnable()
		{
			SceneManager.sceneLoaded += sceneLoadSetup;
		}

		public void OnDisable()
		{
			SceneManager.sceneLoaded -= sceneLoadSetup;
		}

		private void sceneLoadSetup(Scene scene, LoadSceneMode mode)
		{
			if (((Scene)(ref scene)).name != "Slab_10b")
			{
				DeathReset();
			}
			else
			{
				SpawnWidow();
			}
		}

		private static async void SpawnWidow()
		{
			widowClone = await WidowSceneLoader.LoadWidowIntoScene("Belltown_Shrine", SceneManager.GetSceneByName("Slab_10b"));
			SetupWidow();
		}

		private static void SetupWidow()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			widowClone.transform.position = new Vector3(47f, 18.5f, 0f);
			GameObject val = WidowSceneLoader.FindGameObjectInChildren("Bellshrine Sequence Bellhart", widowClone);
			val.transform.position = new Vector3(val.transform.position.x, val.transform.position.y, 0.3f);
			GameObject val2 = WidowSceneLoader.FindGameObjectInChildren("Spinner Boss", widowClone);
			ConstrainPosition component = val2.GetComponent<ConstrainPosition>();
			component.constrainX = true;
			component.xMin = 23.4001f;
			component.xMax = 53.5146f;
			GameObject parent = WidowSceneLoader.FindGameObjectInChildren("HarpShots", widowClone);
			GameObject val3 = WidowSceneLoader.FindGameObjectInChildren("Spinner BellShot 1", parent);
			GameObject val4 = WidowSceneLoader.FindGameObjectInChildren("Spinner BellShot 2", parent);
			FsmUtil.GetFirstActionOfType<FloatClamp>(FSMUtility.LocateMyFSM(val3, "Control"), "Pos R").maxValue = FsmFloat.op_Implicit(49f);
			FsmUtil.GetFirstActionOfType<FloatClamp>(FSMUtility.LocateMyFSM(val3, "Control"), "Pos L").minValue = FsmFloat.op_Implicit(28f);
			FsmUtil.GetFirstActionOfType<FloatClamp>(FSMUtility.LocateMyFSM(val4, "Control"), "Pos R").maxValue = FsmFloat.op_Implicit(49f);
			FsmUtil.GetFirstActionOfType<FloatClamp>(FSMUtility.LocateMyFSM(val4, "Control"), "Pos L").minValue = FsmFloat.op_Implicit(28f);
			widowControl = FSMUtility.LocateMyFSM(val2, "Control");
			widowHealthManager = ((Component)widowControl).gameObject.GetComponent<HealthManager>();
			foundWidowControl = true;
			FsmUtil.GetFirstActionOfType<RandomFloat>(widowControl, "Random Pos").min = FsmFloat.op_Implicit(25f);
			FsmUtil.GetFirstActionOfType<RandomFloat>(widowControl, "Random Pos").max = FsmFloat.op_Implicit(52f);
			FsmUtil.GetFirstActionOfType<RandomFloat>(widowControl, "Close Pos").min = FsmFloat.op_Implicit(25f);
			FsmUtil.GetFirstActionOfType<RandomFloat>(widowControl, "Close Pos").max = FsmFloat.op_Implicit(52f);
			FsmUtil.GetFirstActionOfType<RandomFloat>(widowControl, "Close Pos Low").min = FsmFloat.op_Implicit(25f);
			FsmUtil.GetFirstActionOfType<RandomFloat>(widowControl, "Close Pos Low").max = FsmFloat.op_Implicit(52f);
			FsmUtil.GetFirstActionOfType<CheckXPosition>(widowControl, "Set Scuttle").compareTo = FsmFloat.op_Implicit(38.5f);
			FsmUtil.GetFirstActionOfType<CheckXPosition>(widowControl, "Scream Side").compareTo = FsmFloat.op_Implicit(38.5f);
			FsmUtil.GetFirstActionOfType<CheckXPosition>(widowControl, "Ptn Choice").compareTo = FsmFloat.op_Implicit(33f);
			FsmUtil.GetLastActionOfType<CheckXPosition>(widowControl, "Ptn Choice").compareTo = FsmFloat.op_Implicit(43f);
			FsmUtil.GetFirstActionOfType<FloatClamp>(widowControl, "SlamString 1").minValue = FsmFloat.op_Implicit(25f);
			FsmUtil.GetFirstActionOfType<FloatClamp>(widowControl, "SlamString 1").maxValue = FsmFloat.op_Implicit(52f);
			FsmUtil.GetFirstActionOfType<FloatClamp>(widowControl, "SlamString 3").minValue = FsmFloat.op_Implicit(25f);
			FsmUtil.GetFirstActionOfType<FloatClamp>(widowControl, "SlamString 3").maxValue = FsmFloat.op_Implicit(52f);
			FsmUtil.GetFirstActionOfType<FloatCompare>(widowControl, "Aim SlamString").float2 = FsmFloat.op_Implicit(52f);
			FsmUtil.GetLastActionOfType<FloatCompare>(widowControl, "Aim SlamString").float2 = FsmFloat.op_Implicit(25f);
			FsmUtil.GetLastActionOfType<Wait>(widowControl, "Death Stagger F").time = FsmFloat.op_Implicit(1.2f);
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Slams L"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Slams L 2"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Slams R"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Slams R 2"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Slams Mid"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Slams Mid 2"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Slams Outer"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Slams Outer 2"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Ptn 1"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Ptn 2"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Ptn 3"));
			ShiftSlams(FsmUtil.GetActionsOfType<SpawnObjectFromGlobalPoolDelay>(widowControl, "Ptn 4"));
			FsmUtil.GetLastActionOfType<CompareHP>(widowControl, "Phase Check").integer2 = FsmInt.op_Implicit(PHASE_2_HP);
			widowClone.SetActive(true);
			PlayerData.instance.encounteredFirstWeaver = true;
		}

		private static void ShiftSlams(SpawnObjectFromGlobalPoolDelay[] bells)
		{
			//IL_0013: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			foreach (SpawnObjectFromGlobalPoolDelay val in bells)
			{
				FsmVector3 position = val.position;
				position.Value -= new Vector3(14.5f, 0f, 0f);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayMakerFSM), "Start")]
		private static void OnFsmStart(PlayMakerFSM __instance)
		{
			if (((Object)__instance).name.StartsWith("Spinner AtkBell"))
			{
				((Component)__instance).gameObject.AddComponent<BellStunner>();
				RemoveEventFromState(__instance, "Air", "WALL L");
				RemoveEventFromState(__instance, "Air", "WALL R");
			}
		}

		public static void RemoveEventFromState(PlayMakerFSM fsm, string stateName, string eventName)
		{
			string eventName2 = eventName;
			FsmState state = fsm.Fsm.GetState(stateName);
			if (((state != null) ? state.Transitions : null) != null)
			{
				List<FsmTransition> list = state.Transitions.ToList();
				int num = list.RemoveAll((FsmTransition t) => t.EventName == eventName2);
				if (num > 0)
				{
					state.Transitions = list.ToArray();
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(FsmState), "OnEnter")]
		private static void OnFsmStateEntered(FsmState __instance)
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.name == "Hornet Dead")
			{
				DeathReset();
			}
			string name = ((Object)__instance.Fsm.FsmComponent).name;
			string text = name;
			if (!(text == "First Weaver"))
			{
				if (text == "Spinner Boss" && __instance.name == "Death Stagger")
				{
					widowControl.Fsm.manualUpdate = true;
					((MonoBehaviour)Instance).StartCoroutine(StopWidowAfterDeath());
				}
				return;
			}
			bool flag = !foundSinnerControl;
			bool flag2 = flag;
			if (flag2)
			{
				string name2 = __instance.name;
				bool flag3 = ((name2 == "Refight Appear" || name2 == "Intro Flourish") ? true : false);
				flag2 = flag3;
			}
			if (flag2)
			{
				sinnerControl = __instance.Fsm.FsmComponent;
				sinnerHealthManager = ((Component)sinnerControl).gameObject.GetComponent<HealthManager>();
				foundSinnerControl = true;
				widowControl.SetState("Intro In");
				((Component)widowControl).gameObject.transform.position = new Vector3(32f, 12f, 0f);
				widowControl.Fsm.manualUpdate = false;
				Object.Destroy((Object)(object)FSMUtility.LocateMyFSM(((Component)sinnerControl).gameObject, "Fake Death"));
				Object.Destroy((Object)(object)FSMUtility.LocateMyFSM(((Component)sinnerControl).gameObject, "Stun Control"));
				Object.Destroy((Object)(object)FSMUtility.LocateMyFSM(((Component)widowControl).gameObject, "Fake Death"));
				Object.Destroy((Object)(object)FSMUtility.LocateMyFSM(((Component)widowControl).gameObject, "Stun Control"));
				FsmUtil.RemoveAction(FsmUtil.GetState(widowControl, "Death Stagger F"), 14);
				FsmUtil.RemoveAction(FsmUtil.GetState(widowControl, "Death Stagger"), 18);
				widowTransform = ((Component)widowControl).gameObject.transform;
				widowHealthManager.hp = PHASE_1_HP;
				sinnerHealthManager.hp = PHASE_1_HP;
			}
		}

		private static void DeathReset()
		{
			foundWidowControl = false;
			foundSinnerControl = false;
			p2ForBoth = false;
			Object.Destroy((Object)(object)widowClone);
		}

		[IteratorStateMachine(typeof(<StopWidowAfterDeath>d__30))]
		private static IEnumerator StopWidowAfterDeath()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <StopWidowAfterDeath>d__30(0);
		}

		private void LateUpdate()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (!foundWidowControl || !foundSinnerControl)
			{
				return;
			}
			if (widowTransform.position.y < 12f)
			{
				widowTransform.position = new Vector3(((Component)widowControl).gameObject.transform.position.x, 12f, 0f);
				if (widowControl.ActiveStateName.StartsWith("DashSlash") && !widowControl.ActiveStateName.EndsWith("Land"))
				{
					widowControl.SetState("DashSlash Land");
				}
			}
			int hp = sinnerHealthManager.hp;
			int hp2 = widowHealthManager.hp;
			int num = ((lastSinnerHp >= hp) ? Math.Min(hp, hp2) : Math.Max(hp, hp2));
			if (!p2ForBoth && num < PHASE_3_HP)
			{
				sinnerControl.SetState("Death Stagger F");
				widowControl.SetState("Death Stagger F");
				p2ForBoth = true;
				num = PHASE_3_HP;
			}
			if (hp <= 0 || hp2 <= 0)
			{
				sinnerHealthManager.Die((float?)0f, (AttackTypes)1, false);
				widowHealthManager.Die((float?)0f, (AttackTypes)1, false);
				foundWidowControl = false;
				foundSinnerControl = false;
				p2ForBoth = false;
			}
			sinnerHealthManager.hp = num;
			widowHealthManager.hp = num;
			lastSinnerHp = hp;
		}
	}
	[HarmonyPatch(typeof(Language), "Get")]
	[HarmonyPatch(new Type[]
	{
		typeof(string),
		typeof(string)
	})]
	public class TitleNamePatch
	{
		private static void Postfix(string key, string sheetTitle, ref string __result)
		{
			if (1 == 0)
			{
			}
			string text;
			switch (key)
			{
			case "FIRST_WEAVER_SUPER":
			case "SPINNER_SUPER":
				text = "First Sinner and Widow";
				break;
			case "FIRST_WEAVER_MAIN":
			case "SPINNER_MAIN":
				text = "Revolt and Devotion";
				break;
			default:
				text = __result;
				break;
			}
			if (1 == 0)
			{
			}
			__result = text;
		}
	}
}