Core/Pets: Pet Attack Distance
This commit is contained in:
@@ -462,7 +462,7 @@ namespace Game.AI
|
|||||||
ClearCharmInfoFlags();
|
ClearCharmInfoFlags();
|
||||||
me.GetCharmInfo().SetIsCommandAttack(oldCmdAttack); // For passive pets commanded to attack so they will use spells
|
me.GetCharmInfo().SetIsCommandAttack(oldCmdAttack); // For passive pets commanded to attack so they will use spells
|
||||||
me.GetMotionMaster().Clear();
|
me.GetMotionMaster().Clear();
|
||||||
me.GetMotionMaster().MoveChase(target);
|
me.GetMotionMaster().MoveChase(target, me.GetPetChaseDistance());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2515,6 +2515,29 @@ namespace Game.Entities
|
|||||||
return GetCharmInfo().GetCharmSpell(pos).GetAction();
|
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)
|
public void SetCannotReachTarget(bool cannotReach)
|
||||||
{
|
{
|
||||||
if (cannotReach == m_cannotReachTarget)
|
if (cannotReach == m_cannotReachTarget)
|
||||||
|
|||||||
Reference in New Issue
Block a user