using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ThundergunRevised")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ThundergunRevised")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5711e2a0-d5a7-4ddf-b8d4-00f355fe9397")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-FI")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ArchitectPogoQOL;
[BepInPlugin("plonk.archqol", "Architect Pogo Better", "1.0.0")]
public class MainCode : BaseUnityPlugin
{
public void Awake()
{
}
public void Start()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("plonk.archqol").PatchAll();
}
public void Update()
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
HeroController instance = HeroController.instance;
if (!((Object)(object)instance != (Object)null) || !((Object)(object)instance.crestConfig != (Object)null) || !(((Object)instance.crestConfig).name == "Toolmaster"))
{
return;
}
bool flag = false;
bool flag2 = false;
Transform val = ((Component)instance).gameObject.transform.Find("Attacks/Toolmaster/DownSlash New");
Transform val2 = ((Component)instance).gameObject.transform.Find("Attacks/Toolmaster/DownSlash New Charged");
if ((Object)(object)val != (Object)null)
{
flag = true;
}
if ((Object)(object)val2 != (Object)null)
{
flag2 = true;
}
if (flag && flag2)
{
if (((Behaviour)((Component)val2).GetComponent<PolygonCollider2D>()).enabled || ((Behaviour)((Component)val).GetComponent<PolygonCollider2D>()).enabled)
{
instance.rb2d.linearVelocity = new Vector2(0f, instance.rb2d.linearVelocity.y);
}
LifeTimeMeasure lifeTimeMeasure = default(LifeTimeMeasure);
if (!((Component)val).TryGetComponent<LifeTimeMeasure>(ref lifeTimeMeasure))
{
((Component)val).gameObject.AddComponent<LifeTimeMeasure>().lifeTime = 0.1f;
}
LifeTimeMeasure lifeTimeMeasure2 = default(LifeTimeMeasure);
if (!((Component)val2).TryGetComponent<LifeTimeMeasure>(ref lifeTimeMeasure2))
{
((Component)val2).gameObject.AddComponent<LifeTimeMeasure>().lifeTime = 0.2f;
((Component)val2).gameObject.GetComponent<LifeTimeMeasure>().angleMult = 2f;
}
}
}
}
public class LifeTimeMeasure : MonoBehaviour
{
private float t;
private PolygonCollider2D pc;
public float lifeTime = 0.1f;
public float angleMult = 1f;
private void Start()
{
pc = ((Component)this).GetComponent<PolygonCollider2D>();
}
private void Update()
{
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
if (!((Behaviour)pc).enabled && t > 0f)
{
Debug.Log((object)(((Object)((Component)this).gameObject).name + " " + t));
t = -1f;
}
if (((Behaviour)pc).enabled)
{
if (t < 0f)
{
t = 0f;
}
t += Time.deltaTime;
((Component)this).transform.localRotation = Quaternion.Euler(0f, 0f, 10f * angleMult + 80f * (t / lifeTime) / angleMult);
}
}
}
[HarmonyPatch]
public class Patches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(HeroController), "Downspike")]
public static bool StopArchPogoSideways(HeroController __instance)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.crestConfig == (Object)null)
{
return true;
}
if (((Object)__instance.crestConfig).name != "Toolmaster")
{
return true;
}
if (__instance.downSpikeTimer > __instance.Config.DownSpikeTime)
{
__instance.FinishDownspike();
return false;
}
if (__instance.Config.DownspikeThrusts)
{
__instance.rb2d.linearVelocity = new Vector2(0f, 0f - __instance.Config.DownspikeSpeed);
}
__instance.downSpikeTimer += Time.deltaTime;
return false;
}
}