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 Microsoft.CodeAnalysis;
using On.RoR2.CharacterAI;
using RoR2.CharacterAI;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("DetectionFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DetectionFix")]
[assembly: AssemblyTitle("DetectionFix")]
[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 DetectionFix
{
[BepInPlugin("com.Nuxlar.DetectionFix", "DetectionFix", "1.0.0")]
public class DetectionFix : BaseUnityPlugin
{
public void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
BaseAI.GameObjectPassesSkillDriverFilters += new hook_GameObjectPassesSkillDriverFilters(HopooGames);
}
private bool HopooGames(orig_GameObjectPassesSkillDriverFilters orig, BaseAI self, Target target, AISkillDriver skillDriver, out float separationSqrMagnitude)
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
separationSqrMagnitude = 0f;
if (!Object.op_Implicit((Object)(object)target.gameObject))
{
return false;
}
float num = 1f;
if (Object.op_Implicit((Object)(object)target.healthComponent))
{
num = target.healthComponent.combinedHealthFraction;
}
if ((double)num < (double)skillDriver.minTargetHealthFraction || (double)num > (double)skillDriver.maxTargetHealthFraction)
{
return false;
}
float num2 = 0f;
if (Object.op_Implicit((Object)(object)self.body))
{
num2 = self.body.radius;
}
float num3 = 0f;
if (Object.op_Implicit((Object)(object)target.characterBody))
{
num3 = target.characterBody.radius;
}
Vector3 val = (Object.op_Implicit((Object)(object)self.bodyInputBank) ? self.bodyInputBank.aimOrigin : self.bodyTransform.position);
Vector3 val2 = default(Vector3);
target.GetBullseyePosition(ref val2);
Vector3 val3 = val2 - val;
float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
separationSqrMagnitude = (float)((double)sqrMagnitude - (double)num3 * (double)num3 - (double)num2 * (double)num2);
float num4 = ((skillDriver.minDistanceSqr == 0f) ? (-15f) : skillDriver.minDistanceSqr);
if ((double)separationSqrMagnitude >= (double)num4 && (double)separationSqrMagnitude <= (double)skillDriver.maxDistanceSqr)
{
if (skillDriver.selectionRequiresTargetLoS)
{
return target.hasLoS;
}
return true;
}
return false;
}
}
}