using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("FraudEnemyTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FraudEnemyTweaks")]
[assembly: AssemblyTitle("FraudEnemyTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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 FraudEnemyTweaks
{
[BepInPlugin("com.mel33.fraudenemytweaks", "FraudEnemyTweaks", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private Harmony _harmony;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
_harmony = new Harmony("com.mel33.fraudenemytweaks");
_harmony.PatchAll();
Log.LogInfo((object)"UKEnemyTweaks loaded!");
}
private void OnDestroy()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
public static class PowerHealthPatch
{
private static void Postfix(EnemyIdentifier __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)__instance.enemyType == 40)
{
__instance.machine.health = 30f;
__instance.ForceGetHealth();
}
}
}
[HarmonyPatch(typeof(Power), "Update")]
public static class PowerCheapShotPatch
{
public static readonly Dictionary<Power, float> damageTakenInWindow = new Dictionary<Power, float>();
public static readonly Dictionary<Power, float> windowStartTime = new Dictionary<Power, float>();
public static readonly Dictionary<Power, float> lastHealth = new Dictionary<Power, float>();
private static void Prefix(Power __instance)
{
EnemyCooldowns instance = MonoSingleton<EnemyCooldowns>.Instance;
if ((Object)(object)instance.attackingPower == (Object)(object)__instance || instance.powers.Count <= 1)
{
return;
}
if (__instance.inAction)
{
lastHealth[__instance] = __instance.mach.health;
return;
}
float health = __instance.mach.health;
if (!lastHealth.ContainsKey(__instance))
{
lastHealth[__instance] = health;
windowStartTime[__instance] = Time.time;
damageTakenInWindow[__instance] = 0f;
return;
}
float num = lastHealth[__instance] - health;
lastHealth[__instance] = health;
if (num > 0f)
{
if (!windowStartTime.ContainsKey(__instance))
{
windowStartTime[__instance] = Time.time;
}
damageTakenInWindow.TryGetValue(__instance, out var value);
damageTakenInWindow[__instance] = value + num;
}
if (windowStartTime.TryGetValue(__instance, out var value2) && Time.time - value2 > 2f)
{
damageTakenInWindow[__instance] = 0f;
windowStartTime[__instance] = Time.time;
}
}
}
[HarmonyPatch(typeof(Power), "Throw")]
public static class PowerThrowPatch
{
private static bool Prefix(Power __instance, bool cheapShot)
{
if (!cheapShot)
{
return true;
}
if (PowerCheapShotPatch.damageTakenInWindow.TryGetValue(__instance, out var value) && value >= 3.5f)
{
PowerCheapShotPatch.damageTakenInWindow[__instance] = 0f;
PowerCheapShotPatch.windowStartTime[__instance] = Time.time;
return true;
}
return false;
}
}
[HarmonyPatch(typeof(MirrorReaper), "ProjectileBarrage")]
public class MirrorReaperCooldownPatch
{
private static float lastProjectileBarrageTime;
public static bool Prefix(MirrorReaper __instance)
{
float time = Time.time;
if (__instance.difficulty == 0 && time - lastProjectileBarrageTime < 16f)
{
return false;
}
if (__instance.difficulty == 1 && time - lastProjectileBarrageTime < 12f)
{
return false;
}
if (__instance.difficulty == 2 && time - lastProjectileBarrageTime < 8f)
{
return false;
}
if (__instance.difficulty == 3 && time - lastProjectileBarrageTime < 6f)
{
return false;
}
if (__instance.difficulty == 4 && time - lastProjectileBarrageTime < 4f)
{
return false;
}
lastProjectileBarrageTime = time;
return true;
}
}
[HarmonyPatch(typeof(Deathcatcher), "EnemyDeath")]
public static class DeathcatcherEnemyDeathPatch
{
public static bool Prefix(EnemyIdentifier eid)
{
if ((Object)(object)eid != (Object)null && (Object)(object)((Component)eid).GetComponent<Stalker>() != (Object)null)
{
return false;
}
return true;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}