using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.FalseSonBoss;
using EntityStates.MeridianEvent;
using EntityStates.PrimeMeridian;
using IL.EntityStates.FalseSonBoss;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.FalseSonBoss;
using On.EntityStates.MeridianEvent;
using On.EntityStates.PrimeMeridian;
using RoR2;
using UnityEngine;
[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("FalseSonLaserLock")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4799fc9ce995477832742435a12519e518839eba")]
[assembly: AssemblyProduct("FalseSonLaserLock")]
[assembly: AssemblyTitle("FalseSonLaserLock")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
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;
}
}
}
namespace R2API.Utils
{
[AttributeUsage(AttributeTargets.Assembly)]
public class ManualNetworkRegistrationAttribute : Attribute
{
}
}
namespace FalseSonLaserLock
{
[BepInPlugin("com.Moffein.FalseSonLaserLock", "FalseSonLaserLock", "1.0.1")]
public class FalseSonLaserLockPlugin : BaseUnityPlugin
{
private static int[] activeLasers;
private static int meridianPhase3Count;
private void Awake()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
Stage.onStageStartGlobal += Stage_onStageStartGlobal;
LunarGazeLaserFire.OnEnter += new hook_OnEnter(LunarGazeLaserFire_OnEnter);
LunarGazeLaserFire.OnExit += new hook_OnExit(LunarGazeLaserFire_OnExit);
Phase3.OnEnter += new hook_OnEnter(Phase3_OnEnter);
Phase3.OnExit += new hook_OnExit(Phase3_OnExit);
LunarGazeLeap.OnEnter += new hook_OnEnter(LunarGazeLeap_OnEnter);
FissureSlam.FixedUpdate += new Manipulator(FissureSlam_FixedUpdate);
}
private void LunarGazeLeap_OnEnter(orig_OnEnter orig, LunarGazeLeap self)
{
orig.Invoke(self);
if (!Object.op_Implicit((Object)(object)((EntityState)self).skillLocator) || !((EntityState)self).isAuthority)
{
return;
}
if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.secondary))
{
bool flag = false;
if (((EntityState)self).skillLocator.secondary.stock > 0)
{
flag = true;
((EntityState)self).skillLocator.secondary.stock = 0;
}
if (((EntityState)self).skillLocator.secondary.cooldownRemaining < 12f || flag)
{
((EntityState)self).skillLocator.secondary.rechargeStopwatch = ((EntityState)self).skillLocator.secondary.finalRechargeInterval - 12f;
}
}
if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.special))
{
bool flag2 = false;
if (((EntityState)self).skillLocator.special.stock > 0)
{
flag2 = true;
((EntityState)self).skillLocator.special.stock = 0;
}
if (((EntityState)self).skillLocator.special.cooldownRemaining < 12f || flag2)
{
((EntityState)self).skillLocator.special.rechargeStopwatch = ((EntityState)self).skillLocator.special.finalRechargeInterval - 12f;
}
}
}
private void Phase3_OnExit(orig_OnExit orig, Phase3 self)
{
meridianPhase3Count--;
orig.Invoke(self);
}
private void Phase3_OnEnter(orig_OnEnter orig, Phase3 self)
{
orig.Invoke(self);
meridianPhase3Count++;
}
public static bool IsLaserActive(TeamIndex teamIndex)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return activeLasers[teamIndex] > 0;
}
private void FissureSlam_FixedUpdate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(FissureSlam), "enableColumns")
}))
{
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<bool, FissureSlam, bool>>((Func<bool, FissureSlam, bool>)((bool enableColumns, FissureSlam self) => enableColumns && !IsLaserActive(((BaseState)self).GetTeam())));
}
else
{
Debug.LogError((object)"FalseSonLaserLock: Failed to lock Fissure Slam projectiles.");
}
}
private void LunarGazeLaserFire_OnExit(orig_OnExit orig, LunarGazeLaserFire self)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected I4, but got Unknown
if (meridianPhase3Count > 0)
{
LightningStormController.SetStormActive(true);
}
int num = (int)((BaseState)self).GetTeam();
orig.Invoke(self);
activeLasers[num]--;
if (activeLasers[num] <= 0)
{
activeLasers[num] = 0;
}
}
private void LunarGazeLaserFire_OnEnter(orig_OnEnter orig, LunarGazeLaserFire self)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (meridianPhase3Count > 0)
{
LightningStormController.SetStormActive(false);
}
activeLasers[((BaseState)self).GetTeam()]++;
}
private void Stage_onStageStartGlobal(Stage obj)
{
meridianPhase3Count = 0;
activeLasers = new int[5];
for (int i = 0; i < activeLasers.Length; i++)
{
activeLasers[i] = 0;
}
}
}
}