using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Configgy;
using HarmonyLib;
using OldMassAttack.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OldMassAttack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldMassAttack")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2f935b38-2155-48d1-82c9-b4df47cfc4b1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OldMassAttack
{
public enum Difficulty
{
Standard,
Violent,
Brutal
}
[BepInPlugin("D1g1tal.OldMassAttack", "OldMassAttack", "1.0.5")]
public class MassPlugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("D1g1tal.OldMassAttack");
[Configgable("", "Attack chance", 0, "The chance of the old blue homing attack happening")]
public static float chance = 0.45f;
[Configgable("", "Mod enabled", 0, null)]
public static bool modenabled = true;
[Configgable("", "Difficulty (and above)", 0, null)]
public static Difficulty difficulty = Difficulty.Violent;
[Configgable("", "Minimum player health for attack", 0, "The amount of health the player needs to have for the attack to be forced to happen, else it will be random chance")]
public static int minHp = 50;
[Configgable("", "Shoot blue homing while enraged", 0, null)]
public static bool shootE = true;
private void Awake()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
ConfigBuilder val = new ConfigBuilder("D1g1tal.OldMassAttack", "Old Mass Attack Config");
val.BuildAll();
harmony.PatchAll(typeof(MassPatch));
}
}
}
namespace OldMassAttack.Patches
{
[HarmonyPatch(typeof(Mass))]
internal class MassPatch
{
[HarmonyPatch("ExplosiveAttack")]
[HarmonyPrefix]
private static bool MassExpPatch(Mass __instance, int ___difficulty)
{
if (!MassPlugin.modenabled)
{
return true;
}
int num = 0;
switch (MassPlugin.difficulty)
{
case Difficulty.Standard:
num = 2;
break;
case Difficulty.Violent:
num = 3;
break;
case Difficulty.Brutal:
num = 4;
break;
}
if (num <= ___difficulty)
{
float value = Random.value;
float chance = MassPlugin.chance;
int hp = MonoSingleton<NewMovement>.Instance.hp;
int minHp = MassPlugin.minHp;
if (value <= chance || hp <= minHp)
{
__instance.HomingAttack();
return false;
}
return true;
}
if (___difficulty < num)
{
return true;
}
return true;
}
[HarmonyPatch("CrazyShoot")]
[HarmonyPrefix]
private static void CrazyHoming(Mass __instance, int ___difficulty)
{
if (MassPlugin.modenabled && MassPlugin.shootE)
{
int num = 0;
switch (MassPlugin.difficulty)
{
case Difficulty.Standard:
num = 2;
break;
case Difficulty.Violent:
num = 3;
break;
case Difficulty.Brutal:
num = 4;
break;
}
float value = Random.value;
float chance = MassPlugin.chance;
int hp = MonoSingleton<NewMovement>.Instance.hp;
int minHp = MassPlugin.minHp;
if (value <= chance || hp >= minHp)
{
__instance.ShootHoming((int)Random.value);
}
if (___difficulty >= num)
{
}
}
}
[HarmonyPatch("ShootHoming")]
[HarmonyPrefix]
private static bool PatchSelfKillHoming(int arm, EnemyIdentifier ___eid, Mass __instance, int ___difficulty)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
if (___eid.target != null && !__instance.dead)
{
Transform val = __instance.shootPoints[arm];
Projectile component = Object.Instantiate<GameObject>(__instance.homingProjectile, val.position, val.rotation).GetComponent<Projectile>();
component.target = ___eid.target;
((Component)component).GetComponent<Rigidbody>().velocity = val.up + val.forward * 5f;
component.damage *= ___eid.totalDamageModifier;
component.ignoreExplosions = true;
component.safeEnemyType = ___eid.enemyType;
component.sourceWeapon = ((Component)__instance).gameObject;
Debug.Log((object)$"Safe enemy: {component.safeEnemyType}, Source: {component.sourceWeapon}");
}
return false;
}
}
}