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:49:25 +02:00
parent b93067350c
commit 18665d19b4
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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())
{ {
+1 -1
View File
@@ -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*/) {}