diff options
Diffstat (limited to 'src/server/game/AI/CreatureAI.cpp')
-rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 0f74877007..12698c35dc 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -27,6 +27,7 @@ #include "Player.h" #include "ScriptMgr.h" #include "TemporarySummon.h" +#include "World.h" #include "Vehicle.h" #include "ZoneScript.h" #include <functional> @@ -364,13 +365,18 @@ void CreatureAI::MoveCircleChecks() if ( !victim || !me->IsFreeToMove() || me->HasUnitMovementFlag(MOVEMENTFLAG_ROOT) || - !me->IsWithinMeleeRange(victim) || me == victim->GetVictim() || - (!victim->IsPlayer() && !victim->IsPet()) // only player & pets to save CPU + !me->IsWithinMeleeRange(victim) || me == victim->GetVictim() ) { return; } + /** + * optimization, disable circling movement for NPC vs NPC combat + */ + if (!sWorld->getBoolConfig(CONFIG_CREATURE_REPOSITION_AGAINST_NPCS) && !victim->IsPlayer() && !victim->IsPet()) + return; + me->GetMotionMaster()->MoveCircleTarget(me->GetVictim()); } @@ -378,8 +384,13 @@ void CreatureAI::MoveBackwardsChecks() { Unit *victim = me->GetVictim(); - if (!victim || !me->IsFreeToMove() || me->HasUnitMovementFlag(MOVEMENTFLAG_ROOT) || - (!victim->IsPlayer() && !victim->IsPet())) + if (!victim || !me->IsFreeToMove() || me->HasUnitMovementFlag(MOVEMENTFLAG_ROOT)) + return; + + /** + * optimization, disable backwards movement for NPC vs NPC combat + */ + if (!sWorld->getBoolConfig(CONFIG_CREATURE_REPOSITION_AGAINST_NPCS) && !victim->IsPlayer() && !victim->IsPet()) { return; } |