diff --git a/project/Aki.Custom/Patches/CheckAndAddEnemyPatch.cs b/project/Aki.Custom/Patches/CheckAndAddEnemyPatch.cs
index 1dee66c..b85b8f8 100644
--- a/project/Aki.Custom/Patches/CheckAndAddEnemyPatch.cs
+++ b/project/Aki.Custom/Patches/CheckAndAddEnemyPatch.cs
@@ -2,7 +2,6 @@
using Aki.Reflection.Utils;
using EFT;
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -11,10 +10,6 @@ namespace Aki.Custom.Patches
public class CheckAndAddEnemyPatch : ModulePatch
{
private static Type _targetType;
- private static FieldInfo _sideField;
- private static FieldInfo _enemiesField;
- private static FieldInfo _spawnTypeField;
- private static MethodInfo _addEnemy;
private readonly string _targetMethodName = "CheckAndAddEnemy";
///
@@ -23,10 +18,6 @@ namespace Aki.Custom.Patches
public CheckAndAddEnemyPatch()
{
_targetType = PatchConstants.EftTypes.Single(IsTargetType);
- _sideField = _targetType.GetField("Side");
- _enemiesField = _targetType.GetField("Enemies");
- _spawnTypeField = _targetType.GetField("wildSpawnType_0", BindingFlags.NonPublic | BindingFlags.Instance);
- _addEnemy = _targetType.GetMethod("AddEnemy");
}
private bool IsTargetType(Type type)
@@ -50,27 +41,28 @@ namespace Aki.Custom.Patches
/// removes the !player.AIData.IsAI check
///
[PatchPrefix]
- private static bool PatchPrefix(BotGroupClass __instance, IAIDetails player, ref bool ignoreAI, Dictionary ___Enemies)
+ private static bool PatchPrefix(BotGroupClass __instance, IAIDetails player, ref bool ignoreAI)
{
//var side = (EPlayerSide)_sideField.GetValue(__instance);
//var botType = (WildSpawnType)_spawnTypeField.GetValue(__instance);
+ // Z already has player as enemy BUT Enemies dict is empty, adding them again causes 'existing key' errors
+ if (__instance.InitialBotType == WildSpawnType.bossZryachiy || __instance.InitialBotType == WildSpawnType.followerZryachiy)
+ {
+ return false;
+ }
+
if (!player.HealthController.IsAlive)
{
- return false; // do nothing and skip
+ return false; // Skip original
}
- if (!___Enemies.ContainsKey(player))
+ if (!__instance.Enemies.ContainsKey(player))
{
__instance.AddEnemy(player);
- }
+ }
- // Add enemy to list
- //if (!enemies.ContainsKey(player) && (!playerIsAi || ignoreAI))
- //_addEnemy.Invoke(__instance, new IAIDetails[] { player });
-
-
- return false;
+ return false; // Skip original
}
}
}