TrinityCore/TrinityCore — Issue #5612: [PetAI] Fix pets moving from stay during combat
Author: MrSmite
Created: 2012-03-09 05:17:43+00:00
State: open

Rev:
OS: XP Sp3
DB: 46 + updates

description

When pets are on stay, they move to engage a mob if the mob is within 10 yards. Pets should stay exactly where they are and only engage the mob if it is close enough.

Tested

* Aggressive pet on stay
* Defensive pet on stay

In both cases I stood behind the pet and shot once at a mob approx. 30 yards away. I then turned off auto-shot and waited as the mob ran toward me. When the mob got within melee range of my pet, it engaged properly without moving from the stay point.

Patch

From 851c7e2bd9e77a695660a3df56e14060397c6001 Mon Sep 17 00:00:00 2001
From: MrSmite
Date: Fri, 9 Mar 2012 00:10:34 -0500
Subject: [PATCH] PetAI - Fix pets moving from stay when mobs get close

---
src/server/game/AI/CoreAI/PetAI.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 43973d8..1d9e889 100755
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -456,7 +456,7 @@ bool PetAI::CanAttack(Unit* target)

// Stay - can attack if target is within range or commanded to
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
- return (me->IsWithinMeleeRange(target, MIN_MELEE_REACH) || me->GetCharmInfo()->IsCommandAttack());
+ return (me->IsWithinMeleeRange(target, MELEE_RANGE) || me->GetCharmInfo()->IsCommandAttack());

// Follow
if (me->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
--
1.7.3.1.msysgit.0