diff --git a/src/Jaket/Content/Enemies.cs b/src/Jaket/Content/Enemies.cs index fc86dc18..475c7c48 100644 --- a/src/Jaket/Content/Enemies.cs +++ b/src/Jaket/Content/Enemies.cs @@ -115,7 +115,7 @@ public static bool Sync(EnemyIdentifier enemyId) } /// Synchronizes damage dealt to the enemy. - public static bool SyncDamage(EnemyIdentifier enemyId, float damage, bool explode, float critDamage, GameObject source) + public static bool SyncDamage(EnemyIdentifier enemyId, ref float damage, bool explode, float critDamage, GameObject source) { if (LobbyController.Lobby == null || enemyId.dead) return true; @@ -125,7 +125,7 @@ public static bool SyncDamage(EnemyIdentifier enemyId, float damage, bool explod if (enemyId.TryGetComponent(out var entity) && (entity is not RemotePlayer player || !player.Invincible)) Bullets.SyncDamage(entity.Id, enemyId.hitter, damage, explode, critDamage); - // the entity was created before the lobby + if (!LobbyController.IsOwner) damage = 0f; return true; } diff --git a/src/Jaket/Patches/EnemyPatch.cs b/src/Jaket/Patches/EnemyPatch.cs index 1a61ba9e..cc24fc7c 100644 --- a/src/Jaket/Patches/EnemyPatch.cs +++ b/src/Jaket/Patches/EnemyPatch.cs @@ -16,8 +16,8 @@ public class EnemyPatch [HarmonyPrefix] [HarmonyPatch(nameof(EnemyIdentifier.DeliverDamage))] - static bool Damage(EnemyIdentifier __instance, float multiplier, bool tryForExplode, float critMultiplier, GameObject sourceWeapon) => - Enemies.SyncDamage(__instance, multiplier, tryForExplode, critMultiplier, sourceWeapon); + static bool Damage(EnemyIdentifier __instance, ref float multiplier, bool tryForExplode, float critMultiplier, GameObject sourceWeapon) => + Enemies.SyncDamage(__instance, ref multiplier, tryForExplode, critMultiplier, sourceWeapon); [HarmonyPrefix] [HarmonyPatch(nameof(EnemyIdentifier.Death))]