using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AllEnemiesEnragable;
using AllEnemiesEnragable.MonoBehaviours;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomRay;
using GameConsole;
using GameConsole.CommandTree;
using GameConsole.Commands;
using HarmonyLib;
using HarmonyLib.Tools;
using Sandbox;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AllEnemiesEnragable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AllEnemiesEnragable")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9e52a27d-a24a-4dd0-a448-415ecbc66f36")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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]
public class StalkerSpeedMaintainer : MonoBehaviour
{
public float targetSpeed;
private Stalker stalker;
private float updateInterval = 0.1f;
private float timer = 0f;
private void Start()
{
stalker = ((Component)this).GetComponent<Stalker>();
}
private void Update()
{
timer += Time.deltaTime;
if (timer >= updateInterval)
{
timer = 0f;
if (stalker.eid.totalSpeedModifier != targetSpeed)
{
stalker.eid.totalSpeedModifier = targetSpeed;
stalker.anim.speed = targetSpeed;
stalker.SetSpeed();
}
}
}
}
[HarmonyPatch]
internal class FerrymanEnrage
{
[HarmonyPatch(typeof(RevolverBeam))]
[HarmonyPatch("ExecuteHits")]
[HarmonyPrefix]
public static void Awake_Prefix(RevolverBeam __instance, RaycastHit currentHit)
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
if (!((Object)((Component)__instance).gameObject).name.Contains("Lighting Beam Reflected"))
{
return;
}
Transform transform = ((RaycastHit)(ref currentHit)).transform;
if ((Object)(object)transform == (Object)null)
{
return;
}
GameObject gameObject = ((Component)transform).gameObject;
if (gameObject.CompareTag("Enemy") || gameObject.CompareTag("Body") || gameObject.CompareTag("Limb") || gameObject.CompareTag("EndLimb") || gameObject.CompareTag("Head"))
{
EnemyIdentifier val = ((Component)transform).GetComponentInParent<EnemyIdentifierIdentifier>()?.eid;
if ((Object)(object)val != (Object)null && (int)val.enemyType == 26)
{
AllEnemiesEnragablePlugin.EnrageEnemy(val);
}
}
}
[HarmonyPatch(typeof(Ferryman))]
[HarmonyPatch("ParryableFlash")]
[HarmonyPrefix]
public static bool Awake_Prefix(Ferryman __instance)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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)
if ((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>() != (Object)null)
{
if (__instance.uppercutting)
{
return true;
}
GameObject unparryableFlash = __instance.unparryableFlash;
Vector3 position = __instance.head.position;
Vector3 val = MonoSingleton<CameraController>.Instance.defaultPos - __instance.head.position;
Transform transform = Object.Instantiate<GameObject>(unparryableFlash, position + ((Vector3)(ref val)).normalized, Quaternion.LookRotation(MonoSingleton<CameraController>.Instance.defaultPos - __instance.head.position), __instance.head).transform;
transform.localScale *= 0.025f;
return false;
}
return true;
}
[HarmonyPatch(typeof(Ferryman))]
[HarmonyPatch("UnparryableFlash")]
[HarmonyPrefix]
public static bool unparry_Prefix(Ferryman __instance)
{
if ((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>() != (Object)null && __instance.uppercutting)
{
__instance.ParryableFlash();
return false;
}
return true;
}
}
namespace AllEnemiesEnragable
{
[BepInPlugin("com.banana.AllEnemiesEnragable", "AllEnemiesEnragable", "1.0.0")]
public class AllEnemiesEnragablePlugin : BaseUnityPlugin
{
private const string MyGUID = "com.banana.AllEnemiesEnragable";
private const string PluginName = "AllEnemiesEnragable";
private const string VersionString = "1.0.0";
private static Dictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>();
private static readonly Dictionary<EnemyType, List<string>> MaterialOverrides = new Dictionary<EnemyType, List<string>> {
{
(EnemyType)26,
new List<string> { "T_Ferryman 1" }
} };
private static readonly Harmony Harmony = new Harmony("com.banana.AllEnemiesEnragable");
public static ManualLogSource Log;
public static GameObject rageEffectPrefab;
public static GameObject homingHH;
public static GameObject homingBlue;
public static GameObject Gregnade;
public static bool ForceEnrage = false;
private static Dictionary<EnemyType, ConfigEntry<bool>> enemies = new Dictionary<EnemyType, ConfigEntry<bool>>();
private Dictionary<string, List<EnemyType>> difficulties = new Dictionary<string, List<EnemyType>>
{
{
"Default",
new List<EnemyType>
{
(EnemyType)4,
(EnemyType)7,
(EnemyType)0,
(EnemyType)2,
(EnemyType)8,
(EnemyType)5,
(EnemyType)16,
(EnemyType)9,
(EnemyType)22,
(EnemyType)28,
(EnemyType)33
}
},
{
"Reasonable",
new List<EnemyType>
{
(EnemyType)6,
(EnemyType)34,
(EnemyType)26,
(EnemyType)20
}
},
{
"Quite Challenging",
new List<EnemyType>
{
(EnemyType)6,
(EnemyType)34,
(EnemyType)26,
(EnemyType)20,
(EnemyType)21,
(EnemyType)31,
(EnemyType)17,
(EnemyType)30,
(EnemyType)11,
(EnemyType)27,
(EnemyType)35
}
},
{
"You Asked For This",
Enum.GetValues(typeof(EnemyType)).Cast<EnemyType>().ToList()
}
};
private ConfigEntry<string> selectedDifficulty;
private void Awake()
{
//IL_0051: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: 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)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Expected O, but got Unknown
HarmonyFileLog.Enabled = true;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AllEnemiesEnragable (v1.0.0) is loading...");
Harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AllEnemiesEnragable (v1.0.0) is loaded.");
Log = ((BaseUnityPlugin)this).Logger;
LoadEmbeddedTextures("Textures");
AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Particles/Enemies/RageEffect.prefab");
val.Completed += HandleRageEffectLoaded;
val = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/Projectile Homing.prefab");
val.Completed += HandleHomngBlueLoaded;
val = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/Projectile Explosive HH.prefab");
val.Completed += HandleHomingExploLoaded;
val = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/Grenade.prefab");
val.Completed += HandleGregLoaded;
foreach (EnemyType value2 in Enum.GetValues(typeof(EnemyType)))
{
EnemyType key = value2;
string text = ((object)(EnemyType)(ref key)).ToString();
string text2 = "Enable/disable " + text + " enrage";
ConfigEntry<bool> value = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", text, true, text2);
enemies.Add(key, value);
}
selectedDifficulty = ((BaseUnityPlugin)this).Config.Bind<string>("Difficulty Settings", "Selected Difficulty", "Default", new ConfigDescription("Select the difficulty for enemy enrages.", (AcceptableValueBase)(object)new AcceptableValueList<string>(difficulties.Keys.ToArray()), Array.Empty<object>()));
((BaseUnityPlugin)this).Logger.LogInfo((object)("Selected Difficulty: " + selectedDifficulty.Value));
ApplyDifficulty(selectedDifficulty.Value);
selectedDifficulty.SettingChanged += OnDifficultyChanged;
}
private void OnDifficultyChanged(object sender, EventArgs e)
{
string value = selectedDifficulty.Value;
((BaseUnityPlugin)this).Logger.LogInfo((object)("Difficulty changed to: " + value));
ApplyDifficulty(value);
}
private void ApplyDifficulty(string difficulty)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if (!difficulties.ContainsKey(difficulty))
{
((BaseUnityPlugin)this).Logger.LogError((object)("Difficulty " + difficulty + " not found!"));
return;
}
List<EnemyType> list = difficulties[difficulty];
foreach (KeyValuePair<EnemyType, ConfigEntry<bool>> enemy in enemies)
{
if (list.Contains(enemy.Key))
{
enemy.Value.Value = true;
}
else
{
enemy.Value.Value = false;
}
}
}
private void HandleGregLoaded(AsyncOperationHandle<GameObject> handle)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
if ((int)handle.Status == 1)
{
Gregnade = handle.Result;
((BaseUnityPlugin)this).Logger.LogInfo((object)"RageEffect prefab successfully loaded.");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load RageEffect prefab.");
}
}
private void HandleRageEffectLoaded(AsyncOperationHandle<GameObject> handle)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
if ((int)handle.Status == 1)
{
rageEffectPrefab = handle.Result;
((BaseUnityPlugin)this).Logger.LogInfo((object)"RageEffect prefab successfully loaded.");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load RageEffect prefab.");
}
}
private void HandleHomingExploLoaded(AsyncOperationHandle<GameObject> handle)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
if ((int)handle.Status == 1)
{
homingHH = handle.Result;
((BaseUnityPlugin)this).Logger.LogInfo((object)"RageEffect prefab successfully loaded.");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load RageEffect prefab.");
}
}
private void HandleHomngBlueLoaded(AsyncOperationHandle<GameObject> handle)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
if ((int)handle.Status == 1)
{
homingBlue = handle.Result;
((BaseUnityPlugin)this).Logger.LogInfo((object)"RageEffect prefab successfully loaded.");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load RageEffect prefab.");
}
}
private static void EnrageCow(Minotaur taur)
{
ApplyDefaultRageEffect(taur.eid);
taur.eid.totalSpeedModifier = 2f;
taur.UpdateBuff();
}
public static void EnrageEnemy(EnemyIdentifier enemy)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected I4, but got Unknown
if (enemy.dead || (Object)(object)rageEffectPrefab == (Object)null || (Object)(object)((Component)enemy).GetComponent<IsAlreadyEnraged>() != (Object)null)
{
return;
}
if (((Component)enemy).GetComponentInChildren<IEnrage>() != null)
{
((Component)enemy).GetComponentInChildren<IEnrage>().Enrage();
}
else
{
if (!enemies[enemy.enemyType].Value)
{
return;
}
EnemyType enemyType = enemy.enemyType;
EnemyType val = enemyType;
switch ((int)val)
{
case 32:
EnrageCow(((Component)enemy).GetComponent<Minotaur>());
break;
case 9:
enemy.drone.Enrage();
break;
case 1:
enemy.drone.Enrage();
break;
case 21:
EnrageIdol(enemy);
break;
case 8:
{
V2 componentInChildren = ((Component)enemy).GetComponentInChildren<V2>();
componentInChildren.Enrage();
break;
}
case 34:
{
Guttertank component2 = ((Component)enemy).GetComponent<Guttertank>();
ApplyDefaultRageEffect(component2.eid);
EnemyIdentifier eid2 = component2.eid;
eid2.totalSpeedModifier *= 2f;
component2.SetSpeed();
component2.difficulty = 4;
break;
}
case 33:
{
Gutterman componentInChildren2 = ((Component)enemy).GetComponentInChildren<Gutterman>();
componentInChildren2.Enrage();
break;
}
case 4:
enemy.spider.Enrage();
break;
case 3:
if (((Object)((Component)enemy).gameObject).name.ToLower().Contains("rodent"))
{
EnrageRat(enemy);
break;
}
ApplyDefaultRageEffect(enemy);
EnrageFilth(enemy);
break;
case 13:
case 14:
case 15:
ApplyDefaultRageEffect(enemy);
EnrageProjectileZombies(enemy);
break;
case 31:
ApplyDefaultRageEffect(enemy);
EnrageMannequin(((Component)enemy).GetComponent<Mannequin>());
break;
case 20:
EnrageTurret(((Component)enemy).GetComponent<Turret>());
break;
case 19:
EnrageSisyphus(((Component)enemy).GetComponent<Sisyphus>());
break;
case 12:
EnrageStalker(((Component)enemy).GetComponent<Stalker>());
break;
case 6:
{
Streetcleaner component = ((Component)enemy).GetComponent<Streetcleaner>();
ApplyDefaultRageEffect(component.eid);
EnemyIdentifier eid = component.eid;
eid.totalSpeedModifier *= 2f;
Animator anim = component.anim;
anim.speed *= 2f;
break;
}
case 26:
EnrageFerry(((Component)enemy).GetComponent<Ferryman>());
break;
case 35:
Debug.Log((object)((Object)((Component)enemy).gameObject).name);
if (((Object)((Component)enemy).gameObject).name == "Brain")
{
EnrageBrain(enemy);
}
else
{
EnrageDefenses(enemy);
}
break;
case 11:
EnrageMinosBoss(enemy);
break;
case 18:
EnrageMitosisEnemy(enemy);
break;
case 29:
EnrageOneMustImagineEnemyHappy(enemy);
break;
case 17:
case 30:
EnragePrison(enemy);
break;
case 0:
if (((Object)((Component)enemy).gameObject).name.ToLower().Contains("rodent"))
{
EnrageRat(enemy);
}
break;
default:
ApplyDefaultRageEffect(enemy);
enemy.SpeedBuff(-999f);
enemy.DamageBuff(-999f);
break;
}
}
}
private static void EnrageIdol(EnemyIdentifier enemy)
{
ApplyDefaultRageEffect(enemy);
enemy.BuffAll();
enemy.BuffAll();
enemy.BuffAll();
enemy.BuffAll();
}
private static void EnrageRat(EnemyIdentifier enemy)
{
ApplyDefaultRageEffect(enemy);
enemy.totalSpeedModifier *= 5f;
enemy.UpdateBuffs(false);
}
private static void EnragePrison(EnemyIdentifier enemy)
{
FleshPrison component = ((Component)enemy).GetComponent<FleshPrison>();
ApplyDefaultRageEffect(component.eid);
if ((Object)(object)component.currentBlackHole != (Object)null)
{
BlackHoleProjectile currentBlackHole = component.currentBlackHole;
currentBlackHole.speed *= 2f;
}
}
private static void EnrageOneMustImagineEnemyHappy(EnemyIdentifier enemy)
{
SisyphusPrime component = ((Component)enemy).GetComponent<SisyphusPrime>();
Debug.Log((object)component);
ApplyDefaultRageEffect(enemy);
enemy.totalSpeedModifier *= 1.5f;
enemy.totalDamageModifier *= 1.5f;
component.SetSpeed();
}
private static void EnrageMitosisEnemy(EnemyIdentifier enemy)
{
MinosPrime component = ((Component)enemy).GetComponent<MinosPrime>();
ApplyDefaultRageEffect(component.eid);
EnemyIdentifier eid = component.eid;
eid.totalSpeedModifier *= 1.5f;
EnemyIdentifier eid2 = component.eid;
eid2.totalDamageModifier *= 1.5f;
component.SetSpeed();
}
private static void EnrageLevi(EnemyIdentifier enemy)
{
LeviathanController component = ((Component)enemy).GetComponent<LeviathanController>();
ApplyDefaultRageEffect(component.eid);
EnemyIdentifier eid = component.eid;
eid.totalSpeedModifier *= 3f;
component.UpdateBuff();
}
private static void EnrageMinosBoss(EnemyIdentifier enemy)
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
ApplyDefaultRageEffect(enemy);
enemy.totalSpeedModifier *= 2f;
enemy.UpdateBuffs(false);
Transform val = ((Component)enemy).transform.Find("armed-minos2/Armature.002/root/spine.001/spine.002/neck/Head/Cube (3)");
Transform val2 = ((Component)enemy).transform.Find("armed-minos2/Armature.002/root/spine.001/spine.002/neck/Head/Cube (2)");
if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null)
{
Renderer[] componentsInChildren = ((Component)val).gameObject.GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val3 in array)
{
Material material = new Material(val3.material)
{
color = Color.red
};
val3.material = material;
}
Renderer[] componentsInChildren2 = ((Component)val2).gameObject.GetComponentsInChildren<Renderer>();
Renderer[] array2 = componentsInChildren2;
foreach (Renderer val4 in array2)
{
Material material2 = new Material(val4.material)
{
color = Color.red
};
val4.material = material2;
}
}
}
private static void EnrageDefenses(EnemyIdentifier eid)
{
Debug.Log((object)"Angrify defense!!!!");
ApplyDefaultRageEffect(eid);
eid.SpeedBuff(2f);
eid.UpdateBuffs(false);
}
private static void EnrageBrain(EnemyIdentifier eid)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
ApplyDefaultRageEffect(eid);
eid.SpeedBuff(5f);
eid.UpdateBuffs(false);
GameObject gameObject = ((Component)GameObject.Find("Main").transform.Find("Centaur Full/Hide When Inside/CentaurAnimated/Armature/RootBone/Neck1/Neck2/Neck3/Neck4/Neck5/Head")).gameObject;
if ((Object)(object)gameObject != (Object)null)
{
GameObject val = Object.Instantiate<GameObject>(rageEffectPrefab, gameObject.transform);
val.transform.localPosition = Vector3.zero;
val.transform.localScale = new Vector3(10f, 10f, 10f);
}
}
private static void EnrageTurret(Turret turret)
{
ApplyDefaultRageEffect(turret.eid);
EnemyIdentifier eid = turret.eid;
eid.totalSpeedModifier *= 2f;
turret.UpdateBuff();
}
private static void EnrageMannequin(Mannequin quin)
{
EnemyIdentifier eid = quin.eid;
eid.totalSpeedModifier *= 2f;
quin.SetSpeed();
}
public static void ApplyDefaultRageEffect(EnemyIdentifier enemy)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Expected O, but got Unknown
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Expected O, but got Unknown
Debug.Log((object)$"{enemy.enemyType}_Enrage");
List<string> list = (MaterialOverrides.ContainsKey(enemy.enemyType) ? MaterialOverrides[enemy.enemyType] : null);
Texture2D texture = GetTexture($"{enemy.enemyType}_Enrage");
Debug.Log((object)(((Object)(object)texture != (Object)null) ? ("Texture loaded: " + ((Object)texture).name) : "Rage texture is null"));
EnemySimplifier[] componentsInChildren = ((Component)enemy).GetComponentsInChildren<EnemySimplifier>(true);
Debug.Log((object)$"Found {componentsInChildren.Length} EnemySimplifier components");
EnemySimplifier[] array = componentsInChildren;
foreach (EnemySimplifier val in array)
{
if ((Object)(object)val.meshrenderer == (Object)null)
{
Debug.LogWarning((object)"Renderer is null. Skipping.");
continue;
}
Renderer meshrenderer = val.meshrenderer;
Material[] materials = meshrenderer.materials;
bool flag = false;
for (int j = 0; j < materials.Length; j++)
{
Material mat = materials[j];
Material obj = mat;
Debug.Log((object)(((Object)(object)((obj != null) ? obj.mainTexture : null) != (Object)null) ? ((Object)mat.mainTexture).name : "Material or texture is null"));
if (list == null || list.Any(delegate(string name)
{
Texture mainTexture = mat.mainTexture;
return mainTexture != null && ((Object)mainTexture).name.Contains(name);
}))
{
Debug.Log((object)"Creating new material");
Material val2;
if ((Object)(object)texture != (Object)null)
{
val2 = new Material(mat)
{
mainTexture = (Texture)(object)texture
};
}
else
{
Debug.LogWarning((object)"Rage texture is missing. Using default red material.");
val2 = new Material(mat)
{
color = Color.red
};
}
materials[j] = val2;
flag = true;
}
}
if (flag)
{
meshrenderer.materials = materials;
}
}
Light[] componentsInChildren2 = ((Component)enemy).GetComponentsInChildren<Light>(true);
Light[] array2 = componentsInChildren2;
foreach (Light val3 in array2)
{
val3.color = Color.red;
}
SpriteRenderer[] componentsInChildren3 = ((Component)enemy).GetComponentsInChildren<SpriteRenderer>(true);
SpriteRenderer[] array3 = componentsInChildren3;
foreach (SpriteRenderer val4 in array3)
{
val4.color = Color.red;
}
if ((Object)(object)rageEffectPrefab != (Object)null && (Object)(object)GetTransformFromType(enemy, enemy.enemyType) != (Object)null)
{
GameObject val5 = Object.Instantiate<GameObject>(rageEffectPrefab, GetTransformFromType(enemy, enemy.enemyType));
val5.transform.localPosition = GetOffsetFromType(enemy.enemyType);
val5.transform.localScale = GetScaleAmount(enemy.enemyType, enemy);
((Component)enemy).gameObject.AddComponent<IsAlreadyEnraged>().enrageEffect = val5;
}
else
{
Debug.LogWarning((object)"Rage effect prefab or transform is null. Cannot instantiate effect.");
}
}
private static Transform GetTransformFromType(EnemyIdentifier enemy, EnemyType type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected I4, but got Unknown
switch (type - 3)
{
case 8:
return ((Component)enemy).transform.Find("armed-minos2/Armature.002/root/spine.001/spine.002/neck/Head");
case 24:
return ((Component)enemy).transform.Find("LeviathanHead/Leviathan_SplineHook_Basic/Armature/Bone043/Bone001");
case 0:
if (((Object)((Component)enemy).gameObject).name.ToLower().Contains("rodent"))
{
return ((Component)enemy).transform;
}
return ((Component)enemy).transform.Find("ZombieFilth/Armature.001/Bone001/Spine_01/Spine_02/Neck/Head");
case 10:
return ((Component)enemy).transform.Find("zombierig/Armature.001/Base/Hips/Chest/Neck/Head");
case 11:
return ((Component)enemy).transform.Find("greyhuskrig/Armature.001/Base/Hips/Chest/Neck/Head");
case 12:
return ((Component)enemy).transform.Find("metarig/pelvis/spine.001/spine.002/spine.003/spine.004");
case 9:
return ((Component)enemy).transform.Find("Stalker/Armature/Root/Spine_01/Spine_02/Neck/Head");
case 16:
return ((Component)enemy).transform.Find("ArmStretcherRigIK/metarig/root/spine/spine.001/spine.002/spine.003");
case 23:
return ((Component)enemy).transform.Find("Ferryman2/Armature/Root/Spine_01/Spine_02/Spine_03/Head");
case 3:
return ((Component)enemy).transform.Find("flameboi2rig2/Armature/spine1/spine2/spine3/neck/head");
case 31:
return ((Component)enemy).transform.Find("Guttertank/Armature/Hips/Spine");
case 17:
return ((Component)enemy).transform.Find("TurretBot/Armature/Root/Pelvis/Spine_01/Spine_02/Torso/Neck/Head_Main/Head");
case 18:
return ((Component)enemy).transform.Find("Halo (1)");
case 33:
return ((Component)enemy).transform.Find("Zombie/Armature_001/Base/Hips/Chest/Neck/Head");
case 26:
return ((Component)enemy).transform.Find("Sisyphus (1)/Armature/Root/Spine01/Spine02/Spine03/Neck/Head");
case 15:
return ((Component)enemy).transform.Find("Model/Armature.001/Root/Spine01/Spine02/Spine03/Neck/Head");
case 32:
if (((Object)((Component)enemy).gameObject).name.Contains("CentaurMortar"))
{
return ((Component)enemy).transform.Find("Armature/Barrel1/Barrel2/Barrel3");
}
if (((Object)((Component)enemy).gameObject).name.Contains("CentaurMortar"))
{
return ((Component)enemy).transform.Find("Armature/Barrel1/Barrel2/Barrel3");
}
if (((Object)((Component)enemy).gameObject).name.Contains("CentaurRocketLauncher"))
{
Debug.Log((object)"grrrr");
return ((Component)enemy).transform.Find("Hinge_1/Hinge_2");
}
return ((Component)enemy).transform;
case 29:
return ((Component)enemy).transform.Find("Minotaur_Rigging02/Armature/Spine_01/Spine_02/Spine_03/Neck/Head");
case 28:
return ((Component)enemy).transform.Find("Mannequin/Armature/Spine_01/Spine_02/Spine_03/Spine_04/Neck/Head");
default:
return ((Component)enemy).transform;
}
}
public void LoadEmbeddedTextures(string resourceFolderName)
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
string[] array = manifestResourceNames;
foreach (string text in array)
{
if (!text.Contains(resourceFolderName) || !text.EndsWith(".png"))
{
continue;
}
Stream manifestResourceStream = executingAssembly.GetManifestResourceStream(text);
if (manifestResourceStream != null)
{
byte[] array2 = new byte[manifestResourceStream.Length];
manifestResourceStream.Read(array2, 0, array2.Length);
Texture2D val = new Texture2D(2, 2);
if (ImageConversion.LoadImage(val, array2))
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
fileNameWithoutExtension = fileNameWithoutExtension.Split(new char[1] { '.' }).Last();
textures[fileNameWithoutExtension] = val;
Debug.Log((object)("Loaded embedded texture: " + fileNameWithoutExtension));
}
else
{
Debug.LogError((object)("Failed to load texture from resource: " + text));
}
}
else
{
Debug.LogError((object)("Resource not found: " + text));
}
}
}
public static Texture2D GetTexture(string name)
{
if (textures.TryGetValue(name, out var value))
{
return value;
}
Debug.LogError((object)("Texture not found: " + name));
return null;
}
private static Vector3 GetScaleAmount(EnemyType type, EnemyIdentifier enemy)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
Vector3 one = default(Vector3);
if ((int)type <= 26)
{
if ((int)type != 11)
{
if ((int)type != 26)
{
goto IL_011d;
}
((Vector3)(ref one))..ctor(0.0025f, 0.0025f, 0.0025f);
}
else
{
((Vector3)(ref one))..ctor(10f, 10f, 10f);
}
}
else if ((int)type != 27)
{
if ((int)type != 31)
{
if ((int)type != 35)
{
goto IL_011d;
}
if (((Object)((Component)enemy).gameObject).name.Contains("CentaurMortar") || ((Object)((Component)enemy).gameObject).name.Contains("CentaurRocketLauncher") || ((Object)((Component)enemy).gameObject).name.Contains("CentaurTower"))
{
((Vector3)(ref one))..ctor(0.5f, 0.5f, 0.5f);
}
else
{
((Vector3)(ref one))..ctor(9f, 9f, 9f);
}
}
else
{
((Vector3)(ref one))..ctor(0.005f, 0.005f, 0.005f);
}
}
else
{
((Vector3)(ref one))..ctor(0.01f, 0.01f, 0.01f);
}
return one;
IL_011d:
one = Vector3.one;
return one;
}
private static Vector3 GetOffsetFromType(EnemyType type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
return Vector3.zero;
}
public static List<EnemyIdentifier> GetEnemiesWithType(EnemyType type)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
List<EnemyIdentifier> list = Object.FindObjectsOfType<EnemyIdentifier>().ToList();
list.RemoveAll((EnemyIdentifier x) => x.enemyType != type);
return list;
}
private static void EnrageFilth(EnemyIdentifier Filth)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_0049: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_0068: Expected O, but got Unknown
Animator componentInChildren = ((Component)Filth).GetComponentInChildren<Animator>();
componentInChildren.SetFloat("RunSpeed", 5f);
componentInChildren.speed = 5f;
ZombieMelee component = ((Component)Filth).gameObject.GetComponent<ZombieMelee>();
Material originalMaterial = new Material(component.originalMaterial)
{
color = Color.red
};
component.originalMaterial = originalMaterial;
Material biteMaterial = new Material(component.biteMaterial)
{
color = Color.red
};
component.biteMaterial = biteMaterial;
EnemyIdentifier eid = component.eid;
eid.totalSpeedModifier *= 2f;
component.zmb.SetSpeed();
}
private static void EnrageProjectileZombies(EnemyIdentifier Projectiler)
{
Animator componentInChildren = ((Component)Projectiler).GetComponentInChildren<Animator>();
componentInChildren.SetFloat("Speed", 1.25f);
componentInChildren.SetFloat("RunSpeed", 1.25f);
componentInChildren.speed = 1.25f;
ZombieProjectiles component = ((Component)Projectiler).gameObject.GetComponent<ZombieProjectiles>();
EnemyIdentifier eid = component.eid;
eid.totalSpeedModifier *= 1.25f;
component.zmb.SetSpeed();
}
public static void EnrageStalker(Stalker stalker)
{
ApplyDefaultRageEffect(stalker.eid);
Animator anim = stalker.anim;
anim.speed *= 2f;
EnemyIdentifier eid = stalker.eid;
eid.totalSpeedModifier *= 2f;
stalker.SetSpeed();
stalker.difficulty = 4;
if (!Object.op_Implicit((Object)(object)((Component)stalker).gameObject.GetComponent<StalkerSpeedMaintainer>()))
{
StalkerSpeedMaintainer stalkerSpeedMaintainer = ((Component)stalker).gameObject.AddComponent<StalkerSpeedMaintainer>();
stalkerSpeedMaintainer.targetSpeed = stalker.anim.speed;
}
}
public static void EnrageSisyphus(Sisyphus sisyphus)
{
ApplyDefaultRageEffect(sisyphus.eid);
Animator anim = sisyphus.anim;
anim.speed *= 2f;
EnemyIdentifier eid = sisyphus.eid;
eid.totalSpeedModifier *= 2f;
sisyphus.SetSpeed();
}
public static void EnrageFerry(Ferryman ferry)
{
ApplyDefaultRageEffect(ferry.eid);
Animator anim = ferry.anim;
anim.speed *= 1.2f;
EnemyIdentifier eid = ferry.eid;
eid.totalSpeedModifier *= 1.2f;
ferry.SetSpeed();
}
}
}
namespace AllEnemiesEnragable.Patches
{
[HarmonyPatch(typeof(EnemyIdentifier))]
internal class AlterProperty
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPostfix]
public static void Awake_Prefix(ref AlterOption<bool>[] __result, EnemyIdentifier __instance)
{
AlterOption<bool> item = new AlterOption<bool>
{
name = "Enrage Enemy",
key = "enragable-enemies-all",
callback = delegate(bool value)
{
if (value)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance);
}
},
value = false
};
List<AlterOption<bool>> list = __result.ToList();
list.Add(item);
__result = list.ToArray();
}
}
[HarmonyPatch]
internal class AngryCentaur
{
private static bool AngrifiedEm;
[HarmonyPatch(typeof(Machine))]
[HarmonyPatch("Update")]
[HarmonyPrefix]
public static bool Awake_Prefix(Machine __instance)
{
if (((Object)((Component)__instance).gameObject).name == "Brain")
{
GameObject val = GameObject.Find("Main");
if (!AngrifiedEm && MonoSingleton<StatsManager>.Instance.challengeComplete)
{
AngrifiedEm = true;
}
}
return true;
}
[HarmonyPatch(typeof(Idol))]
[HarmonyPatch("Death")]
[HarmonyPrefix]
public static bool Awake_Prefix(Idol __instance)
{
if ((Object)(object)__instance.target == (Object)null)
{
return true;
}
if (((Object)((Component)__instance.target).gameObject).name == "Brain" && AngrifiedEm)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.target);
}
return true;
}
}
[HarmonyPatch(typeof(Minotaur))]
internal class AngryCow
{
[HarmonyPatch("GotParried")]
[HarmonyPrefix]
public static bool Awake_Prefix(Minotaur __instance)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
return true;
}
}
[HarmonyPatch]
internal class AngryDefenses
{
private static MethodInfo m_MyExtraMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => AddTurretBeamComponent(null, null)));
private static void AddTurretBeamComponent(Projectile beam, MortarLauncher turret)
{
Debug.Log((object)"Adding MortarHomer component");
Debug.Log((object)("Turret name: " + ((Object)((Component)turret).gameObject).name));
((Component)beam).gameObject.AddComponent<MortarHomer>().eid = turret.eid;
}
[HarmonyPatch(typeof(MortarLauncher), "ShootHoming")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
Debug.Log((object)"[Transpiler] Starting transpiler execution");
List<CodeInstruction> codes = new List<CodeInstruction>(instructions);
for (int i = 0; i < codes.Count; i++)
{
yield return codes[i];
if (i + 1 < codes.Count && codes[i].opcode == OpCodes.Call && codes[i].operand.ToString().Contains("Instantiate") && codes[i + 1].opcode == OpCodes.Dup)
{
Debug.Log((object)"[Transpiler] Found Instantiate pattern");
yield return codes[i + 1];
yield return new CodeInstruction(OpCodes.Dup, (object)null);
yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
yield return new CodeInstruction(OpCodes.Call, (object)m_MyExtraMethod);
Debug.Log((object)"[Transpiler] Injected component addition code");
i++;
}
}
}
[HarmonyPatch(typeof(Projectile), "Collided")]
[HarmonyPrefix]
public static void Postfix(Projectile __instance, Collider other)
{
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
MortarHomer mortarHomer = default(MortarHomer);
if (!((Component)__instance).gameObject.TryGetComponent<MortarHomer>(ref mortarHomer) || !__instance.active || ((Component)other).gameObject.CompareTag("Player") || !__instance.active || (!((Component)other).gameObject.CompareTag("Head") && !((Component)other).gameObject.CompareTag("Body") && !((Component)other).gameObject.CompareTag("Limb") && !((Component)other).gameObject.CompareTag("EndLimb")) || ((Component)other).gameObject.CompareTag("Armor"))
{
return;
}
EnemyIdentifierIdentifier componentInParent = ((Component)other).gameObject.GetComponentInParent<EnemyIdentifierIdentifier>();
EnemyIdentifier val = null;
if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.eid != (Object)null)
{
val = componentInParent.eid;
}
if (!((Object)(object)val != (Object)null) || (__instance.alreadyHitEnemies.Count != 0 && __instance.alreadyHitEnemies.Contains(val)) || ((val.enemyType == __instance.safeEnemyType || EnemyIdentifier.CheckHurtException(__instance.safeEnemyType, val.enemyType, __instance.target)) && (!__instance.friendly || val.immuneToFriendlyFire) && !__instance.playerBullet && !__instance.parried))
{
return;
}
if (__instance.playerBullet)
{
if ((Object)(object)mortarHomer.eid == (Object)(object)val)
{
Debug.Log((object)"[Postfix] Apply Enrage");
AllEnemiesEnragablePlugin.ApplyDefaultRageEffect(val);
}
}
else if (__instance.friendly)
{
if ((Object)(object)mortarHomer.eid == (Object)(object)val)
{
Debug.Log((object)"[Postfix] Apply Enrage");
AllEnemiesEnragablePlugin.ApplyDefaultRageEffect(val);
}
}
else if ((Object)(object)mortarHomer.eid == (Object)(object)val)
{
Debug.Log((object)"[Postfix] Apply Enrage");
AllEnemiesEnragablePlugin.EnrageEnemy(val);
}
}
[HarmonyPatch(typeof(Grenade), "Collision")]
[HarmonyPrefix]
public static void PostfixGrendade(Grenade __instance, Collider other)
{
if (!__instance.exploded && !((Component)other).gameObject.CompareTag("Player") && __instance.rocket && !__instance.exploded && (((Component)other).gameObject.CompareTag("Head") || ((Component)other).gameObject.CompareTag("Body") || ((Component)other).gameObject.CompareTag("Limb") || ((Component)other).gameObject.CompareTag("EndLimb")) && !((Component)other).gameObject.CompareTag("Armor"))
{
EnemyIdentifierIdentifier componentInParent = ((Component)other).gameObject.GetComponentInParent<EnemyIdentifierIdentifier>();
EnemyIdentifier val = null;
if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.eid != (Object)null)
{
val = componentInParent.eid;
}
if ((Object)(object)val != (Object)null && __instance.enemy && (Object)(object)componentInParent.eid == (Object)(object)__instance.originEnemy && !componentInParent.eid.blessed)
{
Debug.Log((object)"[Postfix] Apply Enrage");
AllEnemiesEnragablePlugin.EnrageEnemy(val);
}
}
}
}
public class MortarHomer : MonoBehaviour
{
public EnemyIdentifier eid;
}
[HarmonyPatch]
internal class AngryGiantMinos
{
[HarmonyPatch(typeof(MinosBoss))]
[HarmonyPatch("GotParried")]
[HarmonyPrefix]
public static bool Awake_Prefix(MinosBoss __instance)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
return true;
}
[HarmonyPatch(typeof(MinosArm))]
[HarmonyPatch("Flinch")]
[HarmonyPrefix]
public static bool Awake_Prefix(MinosArm __instance)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
return true;
}
}
[HarmonyPatch]
internal class AngriLevi
{
[HarmonyPatch(typeof(LeviathanController))]
[HarmonyPatch("Update")]
[HarmonyPrefix]
public static void Awake_Prefix(LeviathanController __instance)
{
if (!__instance.secondPhase && __instance.stat.health <= __instance.phaseChangeHealth)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
}
[HarmonyPatch(typeof(FleshPrison))]
internal class AngryPrison
{
private static Dictionary<FleshPrison, bool> originalMat = new Dictionary<FleshPrison, bool>();
[HarmonyPatch("Update")]
[HarmonyPrefix]
public static void Update_Prefix(FleshPrison __instance)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
IsAlreadyEnraged isAlreadyEnraged = default(IsAlreadyEnraged);
if (__instance.currentDrones.Count <= 0 && (Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>() == (Object)null)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
else if (__instance.currentDrones.Count > 0 && ((Component)__instance.eid).TryGetComponent<IsAlreadyEnraged>(ref isAlreadyEnraged))
{
Object.Destroy((Object)(object)isAlreadyEnraged.enrageEffect);
Object.Destroy((Object)(object)isAlreadyEnraged);
Renderer[] componentsInChildren = ((Component)__instance.eid).GetComponentsInChildren<Renderer>();
Renderer[] array = componentsInChildren;
foreach (Renderer val in array)
{
val.material.color = Color.white;
}
BlackHoleProjectile currentBlackHole = __instance.currentBlackHole;
currentBlackHole.speed /= 2f;
}
if (__instance.inAction && (Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>() != (Object)null)
{
HandleShooting(__instance);
}
__instance.currentDrones.RemoveAll((DroneFlesh x) => x.eid.dead);
}
private static void HandleShooting(FleshPrison __instance)
{
if (__instance.currentProjectile >= __instance.projectileAmount)
{
return;
}
__instance.homingProjectileCooldown = Mathf.MoveTowards(__instance.homingProjectileCooldown, 0f, Time.deltaTime * (Mathf.Abs(__instance.rotationSpeed) / 10f) * __instance.eid.totalSpeedModifier);
if (__instance.homingProjectileCooldown <= 0f)
{
if (__instance.altVersion)
{
((MonoBehaviour)__instance).StartCoroutine(FireBlueHomingProjectiles(__instance));
}
else
{
FireRegularHomingProjectile(__instance);
}
}
}
private static IEnumerator FireBlueHomingProjectiles(FleshPrison __instance)
{
Rigidbody rigidbody = default(Rigidbody);
for (int i = 0; i < 25; i++)
{
GameObject gameObject2 = Object.Instantiate<GameObject>(AllEnemiesEnragablePlugin.homingBlue, __instance.rotationBone.position + __instance.rotationBone.up * 8f, __instance.rotationBone.rotation);
Projectile component = gameObject2.GetComponent<Projectile>();
component.target = __instance.eid.target;
component.safeEnemyType = (EnemyType)30;
gameObject2.transform.SetParent(((Component)__instance).transform, true);
if (gameObject2.TryGetComponent<Rigidbody>(ref rigidbody))
{
rigidbody.AddForce(Vector3.up * 50f, (ForceMode)2);
}
yield return (object)new WaitForSeconds(0f);
rigidbody = null;
}
}
private static void FireRegularHomingProjectile(FleshPrison __instance)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(AllEnemiesEnragablePlugin.homingHH, __instance.rotationBone.position + __instance.rotationBone.up * 8f, __instance.rotationBone.rotation);
Projectile component = val.GetComponent<Projectile>();
component.target = __instance.eid.target;
component.safeEnemyType = (EnemyType)17;
val.transform.SetParent(((Component)__instance).transform, true);
Rigidbody val2 = default(Rigidbody);
if (val.TryGetComponent<Rigidbody>(ref val2))
{
val2.AddForce(Vector3.up * 50f, (ForceMode)2);
}
}
[HarmonyPatch("Awake")]
[HarmonyPrefix]
public static void Awake_Prefix(FleshPrison __instance)
{
if (!originalMat.ContainsKey(__instance))
{
originalMat.Add(__instance, __instance.altVersion);
}
}
[HarmonyPatch("SpawnInsignia")]
[HarmonyPostfix]
public static void Insigna(FleshPrison __instance)
{
//IL_0051: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)((Component)__instance.eid).gameObject.GetComponent<IsAlreadyEnraged>() != (Object)null) || __instance.eid.target == null)
{
return;
}
__instance.inAction = false;
GameObject val = Object.Instantiate<GameObject>(__instance.insignia, __instance.eid.target.position, Quaternion.identity);
Vector3 velocity = __instance.eid.target.GetVelocity();
velocity.y = 0f;
if (((Vector3)(ref velocity)).magnitude > 0f)
{
val.transform.LookAt(__instance.eid.target.position + velocity);
}
else
{
val.transform.Rotate(Vector3.up * Random.Range(0f, 360f), (Space)1);
}
val.transform.Rotate(Vector3.right * 90f, (Space)1);
VirtueInsignia val2 = default(VirtueInsignia);
if (val.TryGetComponent<VirtueInsignia>(ref val2))
{
val2.predictive = true;
val2.noTracking = true;
val2.otherParent = ((Component)__instance).transform;
if (__instance.stat.health > __instance.maxHealth / 2f)
{
val2.charges = 2;
}
else
{
val2.charges = 3;
}
if (__instance.difficulty >= 3)
{
VirtueInsignia obj = val2;
obj.charges += __instance.difficulty - 2;
}
val2.windUpSpeedMultiplier = 0.5f;
VirtueInsignia obj2 = val2;
obj2.windUpSpeedMultiplier *= __instance.eid.totalSpeedModifier;
val2.damage = Mathf.RoundToInt((float)val2.damage * __instance.eid.totalDamageModifier);
val2.target = __instance.eid.target;
val2.predictiveVersion = null;
Light val3 = val.AddComponent<Light>();
val3.range = 30f;
val3.intensity = 50f;
}
if (__instance.difficulty >= 2)
{
val.transform.localScale = new Vector3(8f, 2f, 8f);
}
else if (__instance.difficulty == 1)
{
val.transform.localScale = new Vector3(7f, 2f, 7f);
}
else
{
val.transform.localScale = new Vector3(5f, 2f, 5f);
}
GoreZone componentInParent = ((Component)__instance).GetComponentInParent<GoreZone>();
if (Object.op_Implicit((Object)(object)componentInParent))
{
val.transform.SetParent(((Component)componentInParent).transform, true);
}
else
{
val.transform.SetParent(((Component)__instance).transform, true);
}
if (__instance.fleshDroneCooldown < 1f)
{
__instance.fleshDroneCooldown = 1f;
}
}
}
[HarmonyPatch(typeof(ZombieProjectiles))]
internal class AngryProjectilers
{
[HarmonyPatch("ThrowProjectile", new Type[] { })]
[HarmonyPostfix]
public static void Awake_Prefix(ZombieProjectiles __instance)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Invalid comparison between Unknown and I4
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>() == (Object)null))
{
if ((int)__instance.eid.enemyType == 13)
{
DoStray(__instance);
}
else if ((int)__instance.eid.enemyType == 15)
{
Debug.Log((object)"a");
GameObject val = Object.Instantiate<GameObject>(AllEnemiesEnragablePlugin.Gregnade, __instance.shootPos.position, Quaternion.identity);
Debug.Log((object)"a");
Vector3 targetPosition = GetTargetPosition(__instance);
Debug.Log((object)"a");
val.transform.LookAt(targetPosition);
Debug.Log((object)"a");
Transform transform = val.transform;
transform.position += __instance.shootPos.forward * 3.5f;
val.GetComponent<Rigidbody>().AddForce(__instance.shootPos.forward * 70f, (ForceMode)2);
}
}
}
private static void DoStray(ZombieProjectiles __instance)
{
//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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.currentDecProjectile != (Object)null)
{
Object.Destroy((Object)(object)__instance.currentDecProjectile);
__instance.eid.weakPoint = __instance.origWP;
}
__instance.currentProjectile = Object.Instantiate<GameObject>(__instance.projectile, __instance.shootPos.position, Quaternion.identity);
Projectile componentInChildren = __instance.currentProjectile.GetComponentInChildren<Projectile>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.target = __instance.eid.target;
componentInChildren.safeEnemyType = (EnemyType)13;
componentInChildren.speed *= GetSpeedMultiplier(__instance.difficulty);
componentInChildren.damage *= __instance.eid.totalDamageModifier;
}
Vector3 targetPosition = GetTargetPosition(__instance);
__instance.currentProjectile.transform.LookAt(targetPosition);
FireProjectileAtAngle(__instance.currentProjectile, -10f, __instance);
FireProjectileAtAngle(__instance.currentProjectile, 10f, __instance);
}
private static float GetSpeedMultiplier(int difficulty)
{
if (difficulty > 2)
{
return 1.35f;
}
return difficulty switch
{
1 => 0.75f,
0 => 0.5f,
_ => 1f,
};
}
private static Vector3 GetTargetPosition(ZombieProjectiles __instance)
{
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
EnemyTarget target = __instance.eid.target;
if (target != null && target.isPlayer)
{
if (__instance.difficulty >= 4)
{
return MonoSingleton<PlayerTracker>.Instance.PredictPlayerPosition(Vector3.Distance(__instance.currentProjectile.transform.position, __instance.camObj.transform.position) / (float)((__instance.difficulty == 5) ? 90 : Random.Range(110, 180)), true, false);
}
return __instance.camObj.transform.position;
}
if (__instance.eid.target != null)
{
EnemyIdentifierIdentifier componentInChildren = ((Component)__instance.eid.target.targetTransform).GetComponentInChildren<EnemyIdentifierIdentifier>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
return ((Component)componentInChildren).transform.position;
}
return __instance.eid.target.position;
}
return Vector3.zero;
}
private static void FireProjectileAtAngle(GameObject projectile, float angleOffset, ZombieProjectiles __instance)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(projectile, projectile.transform.position, projectile.transform.rotation);
val.transform.Rotate(Vector3.up, angleOffset);
Projectile componentInChildren = val.GetComponentInChildren<Projectile>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.target = __instance.eid.target;
}
}
}
[HarmonyPatch(typeof(MinosPrime))]
internal class AngryMitosis
{
[HarmonyPatch("FixedUpdate")]
[HarmonyPostfix]
public static void Postfix(MinosPrime __instance)
{
if (__instance.enraged && (Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>() == (Object)null)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
[HarmonyPatch("FixedUpdate")]
[HarmonyPostfix]
public static void YOUCANTESCAPE(MinosPrime __instance)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.inAction && (__instance.enraged || Object.op_Implicit((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>())) && Vector3.Distance(((Component)__instance).transform.position, __instance.target.position) > 20f)
{
__instance.TeleportAnywhere();
}
}
[HarmonyPatch("RiderKickActivate")]
[HarmonyPostfix]
public static void DoubleShocker(MinosPrime __instance)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
Physics.Raycast(__instance.aimingBone.position, ((Component)__instance).transform.forward, ref val, 250f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)));
if (__instance.enraged || Object.op_Implicit((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>()))
{
GameObject val2 = Object.Instantiate<GameObject>(__instance.groundWave, ((RaycastHit)(ref val)).point, Quaternion.identity);
val2.transform.up = ((RaycastHit)(ref val)).normal;
val2.transform.SetParent(((Component)__instance.gz).transform);
val2.transform.Rotate(Vector3.forward * 90f, (Space)1);
PhysicalShockwave val3 = default(PhysicalShockwave);
if (val2.TryGetComponent<PhysicalShockwave>(ref val3))
{
val3.enemyType = (EnemyType)18;
val3.damage = Mathf.RoundToInt((float)val3.damage * __instance.eid.totalDamageModifier);
}
}
}
[HarmonyPatch("ProjectileShoot")]
[HarmonyPostfix]
public static void IGotTwoSnakes(MinosPrime __instance)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
if ((__instance.enraged || Object.op_Implicit((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>())) && __instance.target != null)
{
Vector3 val = __instance.target.position - (((Component)__instance).transform.position + Vector3.up);
Quaternion val2 = Quaternion.LookRotation(val);
float num = 15f;
Quaternion val3 = val2 * Quaternion.AngleAxis(0f - num, Vector3.up);
GameObject val4 = Object.Instantiate<GameObject>(__instance.snakeProjectile, __instance.mach.chest.transform.position, __instance.snakeProjectile.transform.rotation);
val4.transform.Rotate(Vector3.up, 0f - num);
ConfigureProjectile(val4, __instance);
Quaternion val5 = val2 * Quaternion.AngleAxis(num, Vector3.up);
GameObject val6 = Object.Instantiate<GameObject>(__instance.snakeProjectile, __instance.mach.chest.transform.position, __instance.snakeProjectile.transform.rotation);
val6.transform.Rotate(Vector3.up, num);
ConfigureProjectile(val6, __instance);
__instance.aiming = false;
__instance.tracking = false;
__instance.fullTracking = false;
}
}
private static void ConfigureProjectile(GameObject projectile, MinosPrime __instance)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
projectile.transform.SetParent(((Component)__instance.gz).transform);
Projectile componentInChildren = projectile.GetComponentInChildren<Projectile>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
object obj = componentInChildren;
obj = ((!__instance.target.isPlayer) ? ((object)__instance.target) : ((object)new EnemyTarget(((Component)MonoSingleton<CameraController>.Instance).transform)));
((Projectile)obj).target = (EnemyTarget)obj;
componentInChildren.damage *= __instance.eid.totalDamageModifier;
}
}
}
[HarmonyPatch(typeof(SisyphusPrime))]
internal class AngrySisyphusPrime
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void Postfix(SisyphusPrime __instance)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
__instance.onPhaseChange.onActivate.AddListener((UnityAction)delegate
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
});
}
[HarmonyPatch("StompShockwave")]
[HarmonyPostfix]
public static void Shocker(SisyphusPrime __instance)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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)
//IL_0090: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
if ((__instance.enraged || Object.op_Implicit((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>())) && __instance.difficulty >= 2)
{
PhysicalShockwave val = __instance.CreateShockwave(new Vector3(__instance.swingLimbs[2].position.x, ((Component)__instance).transform.position.y, __instance.swingLimbs[2].position.z));
val.target = __instance.target;
((Component)val).transform.rotation = ((Component)__instance).transform.rotation;
((Component)val).transform.Rotate(Vector3.forward * 90f, (Space)1);
val.speed *= 2f;
}
}
[HarmonyPatch("ClapShockwave")]
[HarmonyPostfix]
public static void ClapShocker(SisyphusPrime __instance)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if ((__instance.enraged || Object.op_Implicit((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>())) && __instance.difficulty >= 2)
{
PhysicalShockwave val = __instance.CreateShockwave(new Vector3(__instance.swingLimbs[2].position.x, ((Component)__instance).transform.position.y, __instance.swingLimbs[2].position.z));
}
}
[HarmonyPatch("PickAnyAttack")]
[HarmonyPostfix]
public static void NahHedTeleport(SisyphusPrime __instance)
{
if (__instance.enraged || Object.op_Implicit((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>()))
{
int num = 0;
if (num == -1)
{
num = Random.Range(-1, 3);
}
switch (num)
{
case 0:
__instance.TeleportAbove();
break;
case 1:
__instance.TeleportAnywhere();
break;
case 2:
__instance.TeleportOnGround(0);
break;
}
}
}
[HarmonyPatch("FixedUpdate")]
[HarmonyPostfix]
public static void YOUCANTESCAPE(SisyphusPrime __instance)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.inAction && (__instance.enraged || Object.op_Implicit((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>())) && Vector3.Distance(((Component)__instance).transform.position, __instance.heightAdjustedTargetPos) > 20f)
{
__instance.TeleportAnywhere(true);
}
}
}
[HarmonyPatch(typeof(Buffs))]
internal class BuffsForceEnrage
{
[HarmonyPatch("BuildTree")]
[HarmonyPostfix]
public static void Awake_Prefix(ref Buffs __instance, ref Branch __result, Console con)
{
Node item = (Node)(object)((CommandRoot)__instance).BoolMenu("forceenrage", (Func<bool>)(() => AllEnemiesEnragablePlugin.ForceEnrage), (Action<bool>)delegate(bool value)
{
AllEnemiesEnragablePlugin.ForceEnrage = value;
EnemyIdentifier[] array = Object.FindObjectsOfType<EnemyIdentifier>();
for (int i = 0; i < array.Length; i++)
{
AllEnemiesEnragablePlugin.EnrageEnemy(array[i]);
}
}, false, true);
List<Node> list = __result.children.ToList();
list.Add(item);
__result = CommandRoot.Branch(__result.name, list.ToArray());
}
}
[HarmonyPatch]
internal class CancerousRodentEnrage
{
[HarmonyPatch(typeof(CancerousRodent))]
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void Awake_Prefix(CancerousRodent __instance)
{
if (__instance.harmless)
{
((MonoBehaviour)__instance).StartCoroutine(EnrageAfterTime(__instance, 3f));
__instance.eid.UpdateBuffs(false);
}
}
[HarmonyPatch(typeof(EnemyIdentifier))]
[HarmonyPatch("DeliverDamage")]
[HarmonyPrefix]
public static void Awake_Prefix(EnemyIdentifier __instance)
{
if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("very cancer") && __instance.hitter == "ground slam" && (Object)(object)((Component)__instance).GetComponent<IsAlreadyEnraged>() == (Object)null)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance);
}
}
private static IEnumerator EnrageAfterTime(CancerousRodent __instance, float time)
{
yield return (object)new WaitForSeconds(time);
if (!__instance.eid.dead)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
}
[HarmonyPatch(typeof(Drone))]
internal class DroneEnrage
{
[HarmonyPatch("Enrage")]
[HarmonyPrefix]
public static bool Enrage(Drone __instance)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_006f: Expected O, but got Unknown
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
if ((int)__instance.type == 1)
{
if (__instance.isEnraged)
{
return false;
}
__instance.isEnraged = true;
AllEnemiesEnragablePlugin.ApplyDefaultRageEffect(__instance.eid);
Material shootMaterial = new Material(__instance.shootMaterial)
{
color = Color.red
};
__instance.shootMaterial = shootMaterial;
Material origMaterial = new Material(__instance.origMaterial)
{
color = Color.red
};
__instance.origMaterial = origMaterial;
EnemyIdentifier eid = __instance.eid;
eid.totalSpeedModifier *= 5f;
__instance.UpdateBuff();
__instance.projectile = new AssetReference("6be53089211b2eb4ab93a26541e4e65b");
return false;
}
return true;
}
}
[HarmonyPatch(typeof(EnemyIdentifier))]
internal class EnemyAwake
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void Awake_Postfix(EnemyIdentifier __instance)
{
((MonoBehaviour)__instance).StartCoroutine(Enrage(__instance));
}
private static IEnumerator Enrage(EnemyIdentifier __instance)
{
yield return (object)new WaitForSeconds(0.1f);
if (AllEnemiesEnragablePlugin.ForceEnrage || ((Object)((Component)__instance).gameObject).name == "Mainframe (Hurtable)")
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance);
}
}
}
[HarmonyPatch(typeof(EnemyIdentifier))]
internal class EnemyDeath
{
[HarmonyPatch("Death", new Type[] { typeof(bool) })]
[HarmonyPrefix]
public static void Death(EnemyIdentifier __instance)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Invalid comparison between Unknown and I4
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Invalid comparison between Unknown and I4
if (__instance.dead)
{
return;
}
IsAlreadyEnraged isAlreadyEnraged = default(IsAlreadyEnraged);
if (((Component)__instance).gameObject.TryGetComponent<IsAlreadyEnraged>(ref isAlreadyEnraged))
{
Object.Destroy((Object)(object)isAlreadyEnraged.enrageEffect);
}
if ((int)__instance.enemyClass != 0 && (int)__instance.enemyType != 31 && (Object)(object)__instance.drone == (Object)null && (Object)(object)__instance.idol == (Object)null && (int)__instance.enemyType != 36)
{
return;
}
List<EnemyIdentifier> enemiesWithType = AllEnemiesEnragablePlugin.GetEnemiesWithType(__instance.enemyType);
foreach (EnemyIdentifier item in enemiesWithType)
{
if (!((Object)(object)item == (Object)(object)__instance) && !((Object)(object)((Component)item).GetComponent<DroneFlesh>() != (Object)null) && (int)item.enemyType != 9 && !((Object)(object)((Component)item).gameObject.GetComponent<IsAlreadyEnraged>() != (Object)null))
{
AllEnemiesEnragablePlugin.EnrageEnemy(item);
}
}
}
public static Transform FindChildRecursive(Transform parent, string childName)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
foreach (Transform item in parent)
{
Transform val = item;
if (((Object)val).name == childName)
{
return val;
}
Transform val2 = FindChildRecursive(val, childName);
if ((Object)(object)val2 != (Object)null)
{
return val2;
}
}
return null;
}
public static void PrintHierarchy(Transform parent, int depth = 0)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
Debug.Log((object)(new string('-', depth) + ((Object)parent).name));
foreach (Transform item in parent)
{
Transform parent2 = item;
PrintHierarchy(parent2, depth + 1);
}
}
}
[HarmonyPatch]
internal class AlreadyEnragablesEveryDifficultyEnrage
{
[HarmonyPatch(typeof(Gutterman), "ShieldBreak", new Type[]
{
typeof(bool),
typeof(bool)
})]
[HarmonyPrefix]
public static void Awake_Prefix(Gutterman __instance, bool player = true, bool flash = true)
{
if (__instance.difficulty < 4 && player)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
[HarmonyPatch(typeof(Gutterman), "GotParried")]
[HarmonyPrefix]
public static void Awake_Prefix(Gutterman __instance)
{
if (__instance.difficulty < 4)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
[HarmonyPatch(typeof(SpiderBody), "Update")]
[HarmonyPrefix]
public static void Awake_Prefix(SpiderBody __instance)
{
if (__instance.difficulty <= 2 && (Object)(object)__instance.currentEnrageEffect == (Object)null && __instance.health < __instance.maxHealth / 2f)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
[HarmonyPatch(typeof(Mindflayer), "Update")]
[HarmonyPrefix]
public static void Awake_Prefix(Mindflayer __instance)
{
if (__instance.difficulty <= 2 && __instance.active && __instance.mach.health < 15f && !__instance.enraged)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
}
[HarmonyPatch]
public static class Turret_Shoot_Patch
{
private static MethodInfo m_MyExtraMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => AddTurretBeamComponent(null, null)));
private static void AddTurretBeamComponent(RevolverBeam beam, Turret turret)
{
Debug.Log((object)"grrrr");
Debug.Log((object)((Object)((Component)turret).gameObject).name);
((Component)beam).gameObject.AddComponent<TurretBeam>().eid = turret.eid;
}
[HarmonyPatch(typeof(Turret), "Shoot")]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Call && list[i].operand is MethodInfo methodInfo && methodInfo.Name == "Instantiate" && methodInfo.DeclaringType == typeof(Object))
{
Debug.Log((object)"Instantiate method!");
num = i;
break;
}
}
if (num != -1)
{
Debug.Log((object)"adding lines");
list.InsertRange(num + 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[3]
{
new CodeInstruction(OpCodes.Dup, (object)null),
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
new CodeInstruction(OpCodes.Call, (object)m_MyExtraMethod)
});
}
return list;
}
}
[HarmonyPatch(typeof(RevolverBeam), "PiercingShotCheck")]
public class BeamPatch
{
[HarmonyPrefix]
public static void ExecuteHits_Prefix(RevolverBeam __instance)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)__instance.enemiesPierced);
if (__instance.enemiesPierced >= __instance.hitList.Count)
{
Debug.Log((object)(__instance.enemiesPierced + " :("));
return;
}
RaycastResult val = __instance.hitList[__instance.enemiesPierced];
RaycastHit rrhit = val.rrhit;
Transform transform = val.transform;
if ((Object)(object)transform == (Object)null)
{
Debug.Log((object)(__instance.enemiesPierced + " :(("));
return;
}
Debug.Log((object)(__instance.enemiesPierced + " :))"));
GameObject gameObject = ((Component)transform).gameObject;
Coin val2 = default(Coin);
if (gameObject.TryGetComponent<Coin>(ref val2))
{
Debug.Log((object)(__instance.enemiesPierced + ":)))"));
TurretBeam turretBeam = default(TurretBeam);
if (((Component)__instance).gameObject.TryGetComponent<TurretBeam>(ref turretBeam))
{
Debug.Log((object)"aaaa");
AllEnemiesEnragablePlugin.EnrageEnemy(turretBeam.eid);
}
}
}
}
internal class TurretBeam : MonoBehaviour
{
public EnemyIdentifier eid;
}
[HarmonyPatch(typeof(Guttertank))]
internal class NotHappyGuttertank
{
[HarmonyPatch("GotParried")]
[HarmonyPrefix]
public static void Awake_Prefix(Guttertank __instance)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
[HarmonyPatch]
internal class SisyphusEnrage
{
[HarmonyPatch(typeof(EnemyIdentifier))]
[HarmonyPatch("DeliverDamage")]
[HarmonyPrefix]
public static void Awake_Prefix(EnemyIdentifier __instance)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
if ((int)__instance.enemyType == 19 && __instance.hitter == "cannonball" && (Object)(object)((Component)__instance).GetComponent<IsAlreadyEnraged>() == (Object)null)
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance);
}
}
[HarmonyPatch(typeof(Sisyphus))]
[HarmonyPatch("StompExplosion")]
[HarmonyPrefix]
public static void Awake_Prefix(Sisyphus __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
PhysicalShockwave val = Object.Instantiate<PhysicalShockwave>(__instance.m_ShockwavePrefab, ((Component)__instance).transform.position, Quaternion.identity);
PhysicalShockwave val2 = Object.Instantiate<PhysicalShockwave>(__instance.m_ShockwavePrefab, ((Component)__instance).transform.position, Quaternion.identity);
((Component)val2).transform.up = ((Component)__instance).transform.right;
}
[HarmonyPatch(typeof(Sisyphus))]
[HarmonyPatch("FixedUpdate")]
[HarmonyPrefix]
public static void Update_Prefix(Sisyphus __instance)
{
if (__instance.gce.onGround && !__instance.nma.isOnNavMesh && !__instance.nma.isOnOffMeshLink && __instance.eid.target != null && __instance.gce.onGround && !__instance.nma.isOnNavMesh && !__instance.nma.isOnOffMeshLink && !__instance.inAction)
{
__instance.stuckChecker = Mathf.MoveTowards(__instance.stuckChecker, 3f, Time.fixedDeltaTime * 2f);
}
}
}
[HarmonyPatch(typeof(Stalker))]
internal class StalkerEnrager
{
[HarmonyPatch("SlowUpdate")]
[HarmonyPrefix]
public static void Awake_Prefix(Stalker __instance)
{
IsAlreadyEnraged isAlreadyEnraged = default(IsAlreadyEnraged);
if (__instance.eid.target != null && __instance.eid.target.isPlayer && !((Component)__instance.eid).TryGetComponent<IsAlreadyEnraged>(ref isAlreadyEnraged))
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
[HarmonyPatch("SandExplode")]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
Debug.Log((object)"[Transpiler] Starting transpiler execution");
List<CodeInstruction> codes = new List<CodeInstruction>(instructions);
for (int i = 0; i < codes.Count; i++)
{
yield return codes[i];
if (codes[i].opcode == OpCodes.Stloc_0 && i > 0 && codes[i - 1].opcode == OpCodes.Call && codes[i - 1].operand.ToString().Contains("Instantiate"))
{
Debug.Log((object)"[Transpiler] Found explosion instantiation point");
yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
yield return CodeInstruction.LoadField(typeof(Stalker), "eid", false);
yield return CodeInstruction.Call(typeof(Component), "GetComponent", (Type[])null, new Type[1] { typeof(IsAlreadyEnraged) });
yield return new CodeInstruction(OpCodes.Dup, (object)null);
yield return CodeInstruction.Call(typeof(StalkerEnrager), "LogComponentCheck", (Type[])null, (Type[])null);
Label skipLabel = default(Label);
yield return new CodeInstruction(OpCodes.Brfalse, (object)skipLabel);
Debug.Log((object)"[Transpiler] Adding scale modification code");
yield return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
yield return CodeInstruction.Call(typeof(GameObject), "get_transform", (Type[])null, (Type[])null);
yield return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
yield return CodeInstruction.Call(typeof(GameObject), "get_transform", (Type[])null, (Type[])null);
yield return CodeInstruction.Call(typeof(Transform), "get_localScale", (Type[])null, (Type[])null);
yield return new CodeInstruction(OpCodes.Ldc_R4, (object)2f);
yield return CodeInstruction.Call(typeof(Vector3), "op_Multiply", new Type[2]
{
typeof(Vector3),
typeof(float)
}, (Type[])null);
yield return CodeInstruction.Call(typeof(Transform), "set_localScale", (Type[])null, (Type[])null);
yield return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
yield return CodeInstruction.Call(typeof(GameObject), "get_transform", (Type[])null, (Type[])null);
yield return CodeInstruction.Call(typeof(Transform), "get_localScale", (Type[])null, (Type[])null);
yield return CodeInstruction.Call(typeof(StalkerEnrager), "LogScale", (Type[])null, (Type[])null);
codes[i + 1].labels.Add(skipLabel);
}
}
}
private static void LogComponentCheck(Component component)
{
Debug.Log((object)$"[SandExplode] IsAlreadyEnraged component found on EID: {(Object)(object)component != (Object)null}");
}
private static void LogScale(Vector3 scale)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)$"[SandExplode] Explosion scale after modification: {scale}");
}
}
[HarmonyPatch]
internal class StreetCleanerEnrage
{
[HarmonyPatch(typeof(Streetcleaner))]
[HarmonyPatch("DeflectShot")]
[HarmonyPrefix]
public static void Awake_Prefix(Streetcleaner __instance)
{
if (!__instance.dead && !((Object)(object)__instance.eid == (Object)null) && !((Object)(object)((Component)__instance.eid).GetComponent<IsAlreadyEnraged>() != (Object)null))
{
AllEnemiesEnragablePlugin.EnrageEnemy(__instance.eid);
}
}
[HarmonyPatch(typeof(BulletCheck))]
[HarmonyPatch("OnTriggerEnter")]
[HarmonyPrefix]
public static bool Awake_Prefix(BulletCheck __instance, Collider other)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
Streetcleaner sc = __instance.sc;
if ((Object)(object)sc == (Object)null)
{
return true;
}
if ((Object)(object)((Component)sc.eid).GetComponent<IsAlreadyEnraged>() == (Object)null)
{
return true;
}
CheckerType type = __instance.type;
if ((int)type > 0)
{
return true;
}
if (((Component)other).gameObject.layer == 14)
{
Grenade component = ((Component)other).GetComponent<Grenade>();
if ((Object)(object)component != (Object)null)
{
component.enemy = true;
component.CanCollideWithPlayer(true);
Streetcleaner sc2 = __instance.sc;
if ((Object)(object)sc2 != (Object)null)
{
sc2.DeflectShot();
}
Rigidbody component2 = ((Component)other).GetComponent<Rigidbody>();
Vector3 val = component2.velocity;
float magnitude = ((Vector3)(ref val)).magnitude;
val = ((Component)MonoSingleton<CameraController>.instance).transform.position - ((Component)other).transform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
component2.velocity = normalized * magnitude;
((Component)other).transform.forward = normalized;
__instance.aud.Play();
return false;
}
Streetcleaner sc3 = __instance.sc;
if ((Object)(object)sc3 == (Object)null)
{
return false;
}
sc3.Dodge();
return false;
}
return false;
}
}
}
namespace AllEnemiesEnragable.MonoBehaviours
{
internal class IsAlreadyEnraged : MonoBehaviour
{
public GameObject enrageEffect;
}
}