mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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);
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
|
||||
@@ -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*/) {}
|
||||
|
||||
Reference in New Issue
Block a user