Decompiled source of Jammed Lord of the Jammed v1.1.0

JammedLotJBIE.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using MonoMod.Cil;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("JammedLotJBIE")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JammedLotJBIE")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a2280127-5846-4118-b459-abebfbeaf793")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 JammedLotJBIE
{
	public static class ILTools
	{
		public static bool JumpToNext(this ILCursor crs, Func<Instruction, bool> match, int times = 1)
		{
			for (int i = 0; i < times; i++)
			{
				if (!crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { match }))
				{
					return false;
				}
			}
			return true;
		}

		public static bool JumpBeforeNext(this ILCursor crs, Func<Instruction, bool> match, int times = 1)
		{
			for (int i = 0; i < times; i++)
			{
				if (!crs.TryGotoNext((MoveType)((i != times - 1) ? 2 : 0), new Func<Instruction, bool>[1] { match }))
				{
					return false;
				}
			}
			return true;
		}

		public static IEnumerable MatchAfter(this ILCursor crs, Func<Instruction, bool> match)
		{
			Instruction curr = crs.Next;
			crs.Index = 0;
			while (crs.JumpToNext(match))
			{
				yield return null;
			}
			crs.Next = curr;
		}

		public static IEnumerable MatchBefore(this ILCursor crs, Func<Instruction, bool> match)
		{
			Instruction curr = crs.Next;
			crs.Index = 0;
			while (crs.JumpBeforeNext(match))
			{
				Instruction c = crs.Next;
				yield return null;
				crs.Goto(c, (MoveType)2, false);
			}
			crs.Next = curr;
		}

		public static VariableDefinition DeclareLocal<T>(this ILContext ctx)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			VariableDefinition val = new VariableDefinition(ctx.Import(typeof(T)));
			ctx.Body.Variables.Add(val);
			return val;
		}

		public static VariableDefinition DeclareLocal<T>(this ILCursor crs)
		{
			return crs.Context.DeclareLocal<T>();
		}

		public static bool TryGotoArg(this ILCursor crs, Instruction targetInstr, int argIndex, int instance = 0)
		{
			if (argIndex < 0)
			{
				return false;
			}
			if (instance < 0)
			{
				return false;
			}
			if (targetInstr == null)
			{
				return false;
			}
			List<Instruction> argumentInstructions = targetInstr.GetArgumentInstructions(crs.Context, argIndex);
			if (instance >= argumentInstructions.Count)
			{
				return false;
			}
			crs.Goto(argumentInstructions[instance], (MoveType)2, false);
			return true;
		}

		public static bool TryGotoArg(this ILCursor crs, int argIndex, int instance = 0)
		{
			return crs.TryGotoArg(crs.Next, argIndex, instance);
		}

		public static IEnumerable MatchArg(this ILCursor crs, Instruction targetInstr, int argIndex)
		{
			if (argIndex < 0 || targetInstr == null)
			{
				yield break;
			}
			Instruction curr = crs.Next;
			List<Instruction> argumentInstrs = targetInstr.GetArgumentInstructions(crs.Context, argIndex);
			foreach (Instruction arg in argumentInstrs)
			{
				crs.Goto(arg, (MoveType)2, false);
				yield return null;
			}
			crs.Next = curr;
		}

		public static IEnumerable MatchArg(this ILCursor crs, int argIndex)
		{
			return crs.MatchArg(crs.Next, argIndex);
		}

		private static List<Instruction> GetArgumentInstructions(this Instruction instruction, ILContext context, int argumentIndex)
		{
			int num = instruction.InputCount();
			int num2 = num - argumentIndex - 1;
			if (num2 < 0)
			{
				Debug.Log((object)$"Argument index {argumentIndex} is higher than the highest argument index ({num - 1})");
				return new List<Instruction>();
			}
			List<Instruction> list = instruction.PossiblePreviousInstructions(context);
			List<Instruction> list2 = new List<Instruction>();
			foreach (Instruction item in list)
			{
				BacktrackToArg(item, context, num2, list2);
			}
			list2.Sort((Instruction a, Instruction b) => context.IndexOf(a).CompareTo(context.IndexOf(b)));
			return list2;
		}

		private static void BacktrackToArg(Instruction current, ILContext ctx, int remainingMoves, List<Instruction> foundArgs)
		{
			if (remainingMoves <= 0 && current.OutputCount() > 0)
			{
				if (remainingMoves == 0)
				{
					foundArgs.Add(current);
				}
				return;
			}
			remainingMoves -= current.StackDelta();
			List<Instruction> list = current.PossiblePreviousInstructions(ctx);
			foreach (Instruction item in list)
			{
				BacktrackToArg(item, ctx, remainingMoves, foundArgs);
			}
		}

		public static int InputCount(this Instruction instr)
		{
			//IL_0011: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_0033: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected I4, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Invalid comparison between Unknown and I4
			if (instr == null)
			{
				return 0;
			}
			OpCode opCode = instr.OpCode;
			if ((int)((OpCode)(ref opCode)).FlowControl == 2)
			{
				IMethodSignature val = (IMethodSignature)instr.Operand;
				int num = 0;
				if ((int)((OpCode)(ref opCode)).Code != 114 && val.HasThis && !val.ExplicitThis)
				{
					num++;
				}
				if (val.HasParameters)
				{
					num += val.Parameters.Count;
				}
				if ((int)((OpCode)(ref opCode)).Code == 40)
				{
					num++;
				}
				return num;
			}
			StackBehaviour stackBehaviourPop = ((OpCode)(ref opCode)).StackBehaviourPop;
			if (1 == 0)
			{
			}
			int result;
			switch (stackBehaviourPop - 1)
			{
			case 0:
			case 2:
			case 9:
				result = 1;
				break;
			case 1:
			case 3:
			case 4:
			case 5:
			case 7:
			case 8:
			case 10:
			case 11:
				result = 2;
				break;
			case 6:
			case 12:
			case 13:
			case 14:
			case 15:
			case 16:
				result = 3;
				break;
			default:
				result = 0;
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		public static int OutputCount(this Instruction instr)
		{
			//IL_0011: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0069: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0074: 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_009a: Expected I4, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			if (instr == null)
			{
				return 0;
			}
			OpCode opCode = instr.OpCode;
			if ((int)((OpCode)(ref opCode)).FlowControl == 2)
			{
				IMethodSignature val = (IMethodSignature)instr.Operand;
				int num = 0;
				if ((int)((OpCode)(ref opCode)).Code == 114 || (int)val.ReturnType.MetadataType != 1)
				{
					num++;
				}
				return num;
			}
			StackBehaviour stackBehaviourPush = ((OpCode)(ref opCode)).StackBehaviourPush;
			if (1 == 0)
			{
			}
			int result;
			switch (stackBehaviourPush - 20)
			{
			case 0:
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
				result = 1;
				break;
			case 1:
				result = 2;
				break;
			default:
				result = 0;
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		public static int StackDelta(this Instruction instr)
		{
			return instr.OutputCount() - instr.InputCount();
		}

		public static List<Instruction> PossiblePreviousInstructions(this Instruction instr, ILContext ctx)
		{
			//IL_000e: 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)
			List<Instruction> list = new List<Instruction>();
			Enumerator<Instruction> enumerator = ctx.Instrs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					Instruction current = enumerator.Current;
					if (Array.IndexOf(current.PossibleNextInstructions(), instr) >= 0)
					{
						list.Add(current);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			return list;
		}

		public static Instruction[] PossibleNextInstructions(this Instruction instr)
		{
			//IL_0002: 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_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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected I4, but got Unknown
			OpCode opCode = instr.OpCode;
			FlowControl flowControl = ((OpCode)(ref opCode)).FlowControl;
			if (1 == 0)
			{
			}
			Instruction[] result;
			switch ((int)flowControl)
			{
			case 2:
			case 5:
				result = (Instruction[])(object)new Instruction[1] { instr.Next };
				break;
			case 0:
			{
				Instruction branchTarget2 = instr.GetBranchTarget();
				result = (Instruction[])(object)((branchTarget2 == null) ? new Instruction[0] : new Instruction[1] { branchTarget2 });
				break;
			}
			case 3:
			{
				Instruction branchTarget = instr.GetBranchTarget();
				result = (Instruction[])(object)((branchTarget == null) ? new Instruction[1] { instr.Next } : new Instruction[2] { instr.Next, branchTarget });
				break;
			}
			default:
				result = (Instruction[])(object)new Instruction[0];
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		public static Instruction GetBranchTarget(this Instruction branch)
		{
			object operand = branch.Operand;
			Instruction val = (Instruction)((operand is Instruction) ? operand : null);
			if (val != null)
			{
				return val;
			}
			object operand2 = branch.Operand;
			return ((ILLabel)(((operand2 is ILLabel) ? operand2 : null)?)).Target;
		}

		public static string InstructionToString(this Instruction c)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return ((object)c).ToString();
			}
			catch
			{
				try
				{
					OpCode opCode = c.OpCode;
					OperandType operandType = ((OpCode)(ref opCode)).OperandType;
					if (((int)operandType == 0 || (int)operandType == 15) ? true : false)
					{
						object operand = c.Operand;
						ILLabel val = (ILLabel)((operand is ILLabel) ? operand : null);
						if (val != null)
						{
							object arg = c.Offset;
							opCode = c.OpCode;
							return $"IL_{arg:x4}: {((OpCode)(ref opCode)).Name} IL_{val.Target.Offset:x4}";
						}
					}
					opCode = c.OpCode;
					if ((int)((OpCode)(ref opCode)).OperandType == 10 && c.Operand is IEnumerable<ILLabel> source)
					{
						object arg2 = c.Offset;
						opCode = c.OpCode;
						return string.Format("IL_{0:x4}: {1} {2}", arg2, ((OpCode)(ref opCode)).Name, string.Join(", ", source.Select((ILLabel x) => x.Target.Offset.ToString("x4")).ToArray()));
					}
				}
				catch
				{
				}
			}
			return "This shouldn't be happening";
		}

		public static T EnumeratorGetField<T>(this object obj, string name)
		{
			return (T)obj.GetType().EnumeratorField(name).GetValue(obj);
		}

		public static FieldInfo EnumeratorField(this MethodBase method, string name)
		{
			return method.DeclaringType.EnumeratorField(name);
		}

		public static FieldInfo EnumeratorField(this Type tp, string name)
		{
			return tp.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).First((FieldInfo x) => (object)x != null && x.Name != null && (x.Name.Contains("<" + name + ">") || x.Name == name));
		}
	}
	[HarmonyPatch]
	public class JammedHeroShrine : BraveBehaviour
	{
		public static MethodInfo jhsb_sc_cjc = AccessTools.Method(typeof(JammedHeroShrine), "JammedHeroShrineBehavior_ShrineConversation_CheckJammedCurse", (Type[])null, (Type[])null);

		public static MethodInfo jhsb_sc_jsoa = AccessTools.Method(typeof(JammedHeroShrine), "JammedHeroShrineBehavior_ShrineConversation_JamShrineOnAccept", (Type[])null, (Type[])null);

		public static MethodInfo jhsb_sc_jsod = AccessTools.Method(typeof(JammedHeroShrine), "JammedHeroShrineBehavior_ShrineConversation_JamShrineOnDecline", (Type[])null, (Type[])null);

		public static MethodInfo jhsb_se_stc = AccessTools.Method(typeof(JammedHeroShrine), "JammedHeroShrineBehavior_ShrineEffect_SetTargetCurse", (Type[])null, (Type[])null);

		public void Awake()
		{
			string[] array = new string[3] { "ShrineStatue", "shrine_Base", "shrine_Base (1)" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				Transform val = ((BraveBehaviour)this).transform.Find(text);
				if (!((Object)(object)val == (Object)null))
				{
					tk2dBaseSprite component = ((Component)val).GetComponent<tk2dBaseSprite>();
					if (!((Object)(object)component == (Object)null))
					{
						component.usesOverrideMaterial = true;
						Material material = ((BraveBehaviour)component).renderer.material;
						material.shader = ShaderCache.Acquire("Brave/LitCutoutUberPhantom");
						material.SetFloat("_PhantomGradientScale", 0.75f);
						material.SetFloat("_PhantomContrastPower", 1.3f);
					}
				}
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyILManipulator]
		public static void JammedHeroShrineBehavior_ShrineConversation_Transpiler(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003b: 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_0087: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (!val.JumpToNext((Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 9)))
			{
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Call, (MethodBase)jhsb_sc_cjc);
			if (val.JumpToNext((Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<AdvancedShrineController>(x, "DoShrineEffect")))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Call, (MethodBase)jhsb_sc_jsoa);
				if (val.JumpToNext((Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<AdvancedShrineController>(x, "ResetForReuse"), 2))
				{
					val.Emit(OpCodes.Ldarg_0);
					val.Emit(OpCodes.Call, (MethodBase)jhsb_sc_jsod);
				}
			}
		}

		public static int JammedHeroShrineBehavior_ShrineConversation_CheckJammedCurse(int curseReq, IEnumerator num)
		{
			if (num == null)
			{
				return curseReq;
			}
			AdvancedShrineController val = num.EnumeratorGetField<AdvancedShrineController>("$this");
			if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).GetComponent<JammedHeroShrine>() == (Object)null)
			{
				return curseReq;
			}
			return 19;
		}

		public static void JammedHeroShrineBehavior_ShrineConversation_JamShrineOnAccept(IEnumerator num)
		{
			if (num != null)
			{
				AdvancedShrineController val = num.EnumeratorGetField<AdvancedShrineController>("$this");
				if (!((Object)(object)val == (Object)null) && val.IsLegendaryHeroShrine)
				{
					GameObjectExtensions.GetOrAddComponent<JammedHeroShrine>(((Component)val).gameObject);
				}
			}
		}

		public static void JammedHeroShrineBehavior_ShrineConversation_JamShrineOnDecline(IEnumerator num)
		{
			if (num != null)
			{
				AdvancedShrineController val = num.EnumeratorGetField<AdvancedShrineController>("$this");
				bool flag = num.EnumeratorGetField<bool>("canUse");
				if (!((Object)(object)val == (Object)null || !val.IsLegendaryHeroShrine || flag))
				{
					GameObjectExtensions.GetOrAddComponent<JammedHeroShrine>(((Component)val).gameObject);
				}
			}
		}

		[HarmonyPatch(typeof(AdvancedShrineController), "DoShrineEffect")]
		[HarmonyILManipulator]
		public static void JammedHeroShrineBehavior_ShrineEffect_Transpiler(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003b: 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_0054: 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)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.JumpToNext((Instruction x) => ILPatternMatchingExt.MatchStloc(x, 8)))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloca, 8);
				val.Emit(OpCodes.Call, (MethodBase)jhsb_se_stc);
				if (val.JumpToNext((Instruction x) => ILPatternMatchingExt.MatchStloc(x, 8)))
				{
					val.Emit(OpCodes.Ldarg_0);
					val.Emit(OpCodes.Ldloca, 8);
					val.Emit(OpCodes.Call, (MethodBase)jhsb_se_stc);
				}
			}
		}

		public static void JammedHeroShrineBehavior_ShrineEffect_SetTargetCurse(AdvancedShrineController shrine, ref int curseTarget)
		{
			if (!((Object)(object)shrine == (Object)null) && !((Object)(object)((Component)shrine).GetComponent<JammedHeroShrine>() == (Object)null))
			{
				curseTarget = 19;
			}
		}
	}
	[HarmonyPatch]
	public class JammedLotJBehaviour : BraveBehaviour
	{
		public void Awake()
		{
			((BraveBehaviour)this).sprite.usesOverrideMaterial = true;
			Material material = ((BraveBehaviour)((BraveBehaviour)this).sprite).renderer.material;
			material.shader = ShaderCache.Acquire("Brave/LitCutoutUberPhantom");
			material.SetFloat("_PhantomGradientScale", 0.75f);
			material.SetFloat("_PhantomContrastPower", 1.3f);
			SuperReaperController component = ((Component)this).GetComponent<SuperReaperController>();
			component.MinSpeed *= 1.5f;
			component.MaxSpeed *= 1.5f;
			component.c_particlesPerSecond *= 2;
		}

		[HarmonyPatch(typeof(PlayerStats), "RecalculateStatsInternal")]
		[HarmonyPostfix]
		public static void JamLotJ_RecalculateStats_Postfix()
		{
			SuperReaperController instance = SuperReaperController.Instance;
			if (!((Object)(object)instance == (Object)null) && !((Object)(object)((Component)instance).gameObject == (Object)null))
			{
				int totalCurse = PlayerStats.GetTotalCurse();
				if (!((float)totalCurse < 20f))
				{
					GameObjectExtensions.GetOrAddComponent<JammedLotJBehaviour>(((Component)instance).gameObject);
				}
			}
		}

		[HarmonyPatch(typeof(SuperReaperController), "Start")]
		[HarmonyPostfix]
		public static void JamLotJ_Start_Postfix(SuperReaperController __instance)
		{
			int totalCurse = PlayerStats.GetTotalCurse();
			if (!((float)totalCurse < 20f))
			{
				GameObjectExtensions.GetOrAddComponent<JammedLotJBehaviour>(((Component)__instance).gameObject);
			}
		}

		[HarmonyPatch(typeof(AIBulletBank), "CreateProjectileFromBank")]
		[HarmonyPostfix]
		public static void JamLotJBullets_Postfix(AIBulletBank __instance, GameObject __result)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)((Component)__instance).GetComponent<SuperReaperController>() == (Object)null) && !((Object)(object)((Component)__instance).GetComponent<JammedLotJBehaviour>() == (Object)null) && !((Object)(object)__result == (Object)null))
			{
				Projectile component = __result.GetComponent<Projectile>();
				if (component != null)
				{
					component.ForceBlackBullet = true;
					component.BecomeBlackBullet();
				}
			}
		}
	}
	[BepInPlugin("spapi.etg.jammedlotj", "Jammed Lord of the Jammed", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "spapi.etg.jammedlotj";

		public const string NAME = "Jammed Lord of the Jammed";

		public const string VERSION = "1.1.0";

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("spapi.etg.jammedlotj").PatchAll();
		}
	}
}