*Update moveinLOS assistance code.
--HG-- branch : trunk
This commit is contained in:
+9
-15
@@ -23,6 +23,7 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include "SpellAuras.h"
|
#include "SpellAuras.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
void UnitAI::AttackStart(Unit *victim)
|
void UnitAI::AttackStart(Unit *victim)
|
||||||
{
|
{
|
||||||
@@ -72,22 +73,15 @@ void CreatureAI::OnCharmed(bool apply)
|
|||||||
|
|
||||||
void CreatureAI::MoveInLineOfSight(Unit *who)
|
void CreatureAI::MoveInLineOfSight(Unit *who)
|
||||||
{
|
{
|
||||||
if(!me->getVictim() && me->canStartAttack(who))
|
if(me->getVictim())
|
||||||
AttackStart(who);
|
return;
|
||||||
|
|
||||||
if (who->isInCombat() && who->getVictim() && me->GetCreatureType()==CREATURE_TYPE_HUMANOID && me->IsFriendlyTo(who))
|
if(me->canStartAttack(who))
|
||||||
{
|
AttackStart(who);
|
||||||
if (me->GetDistanceZ(who) <= 2 && me->IsWithinLOSInMap(who))
|
else if(who->getVictim() && me->IsFriendlyTo(who)
|
||||||
{
|
&& me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
|
||||||
float attackRadius = (me->GetAttackDistance(who) *0.5);
|
&& me->canAttack(who->getVictim()))
|
||||||
if (me->IsWithinDistInMap(who, attackRadius))
|
AttackStart(who->getVictim());
|
||||||
{
|
|
||||||
Unit* target = NULL;
|
|
||||||
target = who->getVictim();
|
|
||||||
AttackStart(target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreatureAI::UpdateVictim()
|
bool CreatureAI::UpdateVictim()
|
||||||
|
|||||||
Reference in New Issue
Block a user