Core/Scripts: Add an additional parameter to DoZoneInCombat to define the max range to find a target in to engage (instead of hard coded 50 yards).
This commit is contained in:
@@ -42,7 +42,7 @@ void CreatureAI::Talk(uint8 id, uint64 WhisperGuid)
|
|||||||
sCreatureTextMgr->SendChat(me, id, WhisperGuid);
|
sCreatureTextMgr->SendChat(me, id, WhisperGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/)
|
void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToNearestTarget /* = 50.0f*/)
|
||||||
{
|
{
|
||||||
if (!creature)
|
if (!creature)
|
||||||
creature = me;
|
creature = me;
|
||||||
@@ -59,7 +59,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/)
|
|||||||
|
|
||||||
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
|
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
|
||||||
{
|
{
|
||||||
if (Unit* target = creature->SelectNearestTarget(50))
|
if (Unit* target = creature->SelectNearestTarget(maxRangeToNearestTarget))
|
||||||
creature->AI()->AttackStart(target);
|
creature->AI()->AttackStart(target);
|
||||||
else if (creature->isSummon())
|
else if (creature->isSummon())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class CreatureAI : public UnitAI
|
|||||||
// Called at reaching home after evade
|
// Called at reaching home after evade
|
||||||
virtual void JustReachedHome() {}
|
virtual void JustReachedHome() {}
|
||||||
|
|
||||||
void DoZoneInCombat(Creature* creature = NULL);
|
void DoZoneInCombat(Creature* creature = NULL, float maxRangeToNearestTarget = 50.0f);
|
||||||
|
|
||||||
// Called at text emote receive from player
|
// Called at text emote receive from player
|
||||||
virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {}
|
virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user