Core/Pets: Pet Attack Distance

This commit is contained in:
hondacrx
2018-03-11 14:50:43 -04:00
parent 5e571794bf
commit 39b2467cd0
2 changed files with 24 additions and 1 deletions
+1 -1
View File
@@ -462,7 +462,7 @@ namespace Game.AI
ClearCharmInfoFlags();
me.GetCharmInfo().SetIsCommandAttack(oldCmdAttack); // For passive pets commanded to attack so they will use spells
me.GetMotionMaster().Clear();
me.GetMotionMaster().MoveChase(target);
me.GetMotionMaster().MoveChase(target, me.GetPetChaseDistance());
}
else
{
+23
View File
@@ -2515,6 +2515,29 @@ namespace Game.Entities
return GetCharmInfo().GetCharmSpell(pos).GetAction();
}
public float GetPetChaseDistance()
{
float range = SharedConst.MeleeRange;
for (byte i = 0; i < GetPetAutoSpellSize(); ++i)
{
uint spellID = GetPetAutoSpellOnPos(i);
if (spellID == 0)
continue;
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellID);
if (spellInfo != null)
{
if (spellInfo.GetRecoveryTime() == 0 // No cooldown
&& spellInfo.RangeEntry.Id != 1 /*Self*/ && spellInfo.RangeEntry.Id != 2 /*Combat Range*/
&& spellInfo.GetMinRange() > range)
range = spellInfo.GetMinRange();
}
}
return range;
}
public void SetCannotReachTarget(bool cannotReach)
{
if (cannotReach == m_cannotReachTarget)