using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
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: AssemblyCompany("JacksonOverpowered")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JacksonOverpowered")]
[assembly: AssemblyTitle("JacksonOverpowered")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace JacksonOverpowered;
[BepInPlugin("jaxon.jacksonbeta.jacksonoverpowered", "Jackson Overpowered", "1.3.0")]
public sealed class Plugin : BaseUnityPlugin
{
private Harmony _harmony;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_harmony = new Harmony("jaxon.jacksonbeta.jacksonoverpowered");
_harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Jackson Overpowered 1.3.0 loaded");
}
private void OnDestroy()
{
if (_harmony != null)
{
_harmony.UnpatchSelf();
}
}
}
internal static class JacksonUtil
{
internal static bool IsJackson(PlayerInfo info)
{
if ((Object)(object)info != (Object)null)
{
return info.characterID == "Jackson";
}
return false;
}
internal static PlayerInfo FindOwner(Component component)
{
if ((Object)(object)component == (Object)null)
{
return null;
}
Transform val = component.transform;
while ((Object)(object)val != (Object)null)
{
PlayerInfo component2 = ((Component)val).GetComponent<PlayerInfo>();
if ((Object)(object)component2 != (Object)null)
{
return component2;
}
hitBoxAssigner component3 = ((Component)val).GetComponent<hitBoxAssigner>();
if ((Object)(object)component3 != (Object)null && (Object)(object)component3.info != (Object)null)
{
return component3.info;
}
val = val.parent;
}
return null;
}
}
[HarmonyPatch(typeof(JacksonDuelSuper), "OnEnable")]
internal static class JacksonDuelHealPatch
{
private static void Postfix(JacksonDuelSuper __instance)
{
PlayerInfo val = JacksonUtil.FindOwner((Component)(object)__instance);
if (JacksonUtil.IsJackson(val))
{
val.health = val.maxHealth;
}
}
}
[HarmonyPatch(typeof(JacksonPixelCheck), "OnEnable")]
internal static class HickoryAlwaysCriticalPatch
{
private static bool Prefix(JacksonPixelCheck __instance)
{
PlayerInfo val = (((Object)(object)__instance.infoForTesting != (Object)null) ? __instance.infoForTesting : JacksonUtil.FindOwner((Component)(object)__instance));
if (!JacksonUtil.IsJackson(val) || (Object)(object)val.enemyScript == (Object)null)
{
return true;
}
__instance.info = val;
val.hit = 2;
val.enemyScript.hit = -2;
val.superTimer = 0;
val.enemyScript.superTimer = 0;
return false;
}
}
[HarmonyPatch(typeof(JacksonBullets), "FixedUpdate")]
internal static class InfiniteJacksonAmmoPatch
{
private static void Prefix(JacksonBullets __instance)
{
if (JacksonUtil.IsJackson(((Component)__instance).GetComponent<PlayerInfo>()))
{
__instance.maxCharges = 999;
__instance.charges = 999;
}
}
private static void Postfix(JacksonBullets __instance)
{
if (JacksonUtil.IsJackson(((Component)__instance).GetComponent<PlayerInfo>()))
{
__instance.charges = 999;
}
}
}
[HarmonyPatch(typeof(Options), "OnEnable")]
internal static class JacksonMovePatch
{
private static void Postfix(Options __instance)
{
PlayerInfo val = JacksonUtil.FindOwner((Component)(object)__instance);
if (!JacksonUtil.IsJackson(val))
{
return;
}
string name = ((Object)((Component)__instance).gameObject).name;
if (name.IndexOf("Draw", StringComparison.OrdinalIgnoreCase) >= 0)
{
__instance.lockOut = false;
__instance.actionableFrame = 0;
__instance.chargesSet = false;
}
if (name.IndexOf("Whiff", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("Wiff", StringComparison.OrdinalIgnoreCase) >= 0)
{
__instance.lockOut = false;
__instance.actionableFrame = 0;
__instance.chargesSet = false;
}
if (name.IndexOf("Laser", StringComparison.OrdinalIgnoreCase) >= 0)
{
__instance.lockOut = false;
__instance.actionableFrame = 0;
__instance.chargesSet = false;
__instance.loop = true;
if ((Object)(object)((Component)val).GetComponent<JacksonMinigun>() == (Object)null)
{
((Component)val).gameObject.AddComponent<JacksonMinigun>();
}
}
if (name == "AirPunch" && (Object)(object)((Component)__instance).GetComponent<NairExpanded>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<NairExpanded>();
StretchNair(__instance);
}
}
private static void StretchNair(Options option)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
if (option.frames == null)
{
return;
}
for (int i = 0; i < option.frames.Length; i++)
{
if (option.frames[i] != null && !((Object)(object)option.frames[i].spriteObject == (Object)null))
{
Transform transform = option.frames[i].spriteObject.transform;
transform.localScale = new Vector3(transform.localScale.x * 3f, transform.localScale.y * 2.25f, transform.localScale.z);
}
}
}
}
public sealed class NairExpanded : MonoBehaviour
{
}
[HarmonyPatch(typeof(HitBoxInterpreter), "FixedUpdate")]
internal static class JacksonLaserDamagePatch
{
private static void Prefix(HitBoxInterpreter __instance)
{
if (JacksonUtil.IsJackson(((Object)(object)__instance.info != (Object)null) ? __instance.info : JacksonUtil.FindOwner((Component)(object)__instance)) && IsLaserBullet(((Component)__instance).transform))
{
__instance.strongHit = true;
__instance.weakHit = false;
__instance.hitID = 0;
__instance.stunFrames = 0;
__instance.repeatStunLockout = 0;
__instance.dontDoubleStun = false;
}
}
private static bool IsLaserBullet(Transform transform)
{
Transform val = transform;
while ((Object)(object)val != (Object)null)
{
if (((Object)val).name.IndexOf("Laser", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)val).name.IndexOf("JacksonBullet", StringComparison.OrdinalIgnoreCase) >= 0)
{
return true;
}
val = val.parent;
}
return false;
}
}
public sealed class JacksonMinigun : MonoBehaviour
{
private PlayerInfo _owner;
private JacksonBullets _ammo;
private int _counter;
private void Awake()
{
_owner = ((Component)this).GetComponent<PlayerInfo>();
_ammo = ((Component)this).GetComponent<JacksonBullets>();
}
private void FixedUpdate()
{
if (!JacksonUtil.IsJackson(_owner) || (Object)(object)_ammo == (Object)null || (Object)(object)_owner.currentAnim == (Object)null || ((Object)_owner.currentAnim).name.IndexOf("Laser", StringComparison.OrdinalIgnoreCase) < 0)
{
return;
}
_counter++;
if (_counter % 3 != 0 || _ammo.spawners == null)
{
return;
}
for (int i = 0; i < _ammo.spawners.Length; i++)
{
BasicProjectileSpawner val = _ammo.spawners[i];
if (!((Object)(object)val == (Object)null))
{
((Component)val).gameObject.SetActive(false);
((Component)val).gameObject.SetActive(true);
}
}
_ammo.charges = 999;
}
}
[HarmonyPatch(typeof(projectileTraj), "FixedUpdate")]
internal static class JacksonHomingProjectilePatch
{
private static void Prefix(projectileTraj __instance)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
PlayerInfo val = JacksonUtil.FindOwner((Component)(object)__instance);
if (JacksonUtil.IsJackson(val) && !((Object)(object)val.enemyScript == (Object)null))
{
Vector3 val2 = ((Component)val.enemyScript).transform.position + new Vector3(0f, 2.5f, 0f) - ((Component)__instance).transform.position;
if (!(((Vector3)(ref val2)).sqrMagnitude < 0.001f))
{
float num = Mathf.Max(0.65f, ((Vector3)(ref __instance.traj)).magnitude);
Vector3 val3 = ((Vector3)(ref val2)).normalized * num;
__instance.traj = Vector3.Lerp(__instance.traj, val3, 0.35f);
__instance.accel = Vector3.zero;
}
}
}
}