From 097346aad54d378bc04a7a0a3b15162dcccf35e2 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 25 Apr 2023 08:58:18 -0400 Subject: [PATCH] Core/Units: Prevent backward melee attacks Port From (https://github.com/TrinityCore/TrinityCore/commit/7d5d3cf655b3e701d8a570b03499a388476cbdf9) --- Source/Game/AI/CoreAI/UnitAI.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs index af909feb9..c622525b3 100644 --- a/Source/Game/AI/CoreAI/UnitAI.cs +++ b/Source/Game/AI/CoreAI/UnitAI.cs @@ -62,6 +62,10 @@ namespace Game.AI if (!me.IsWithinMeleeRange(victim)) return; + // Check that the victim is in front of the unit + if (!me.HasInArc(2 * MathF.PI / 3, victim)) + return; + //Make sure our attack is ready and we aren't currently casting before checking distance if (me.IsAttackReady()) {