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:
Machiavelli
2011-09-28 11:47:30 +02:00
parent b93067350c
commit 18665d19b4
2 changed files with 3 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ void CreatureAI::Talk(uint8 id, uint64 WhisperGuid)
sCreatureTextMgr->SendChat(me, id, WhisperGuid);
}
void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/)
void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToNearestTarget /* = 50.0f*/)
{
if (!creature)
creature = me;
@@ -59,7 +59,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/)
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
{
if (Unit* target = creature->SelectNearestTarget(50))
if (Unit* target = creature->SelectNearestTarget(maxRangeToNearestTarget))
creature->AI()->AttackStart(target);
else if (creature->isSummon())
{

View File

@@ -133,7 +133,7 @@ class CreatureAI : public UnitAI
// Called at reaching home after evade
virtual void JustReachedHome() {}
void DoZoneInCombat(Creature* creature = NULL);
void DoZoneInCombat(Creature* creature = NULL, float maxRangeToNearestTarget = 50.0f);
// Called at text emote receive from player
virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {}