Merge pull request #9129 from m7nu3l/patch-2

Core/AI: Inherited AggressorAI, so the wheel is not reinvented.
This commit is contained in:
Aokromes
2013-02-02 21:38:47 -08:00
2 changed files with 7 additions and 31 deletions

View File

@@ -23,35 +23,12 @@
#include "ObjectAccessor.h"
#include "CreatureAIImpl.h"
#define REACTOR_VISIBLE_RANGE (26.46f)
// #define REACTOR_VISIBLE_RANGE (26.46f) - It has not any use at all
int
ReactorAI::Permissible(const Creature* creature)
int ReactorAI::Permissible(const Creature* creature)
{
if (creature->isCivilian() || creature->IsNeutralToAll())
return PERMIT_BASE_REACTIVE;
return PERMIT_BASE_NO;
}
void
ReactorAI::MoveInLineOfSight(Unit*)
{
}
void
ReactorAI::UpdateAI(const uint32 /*time_diff*/)
{
// update i_victimGuid if me->getVictim() !=0 and changed
if (!UpdateVictim())
return;
if (me->isAttackReady())
{
if (me->IsWithinMeleeRange(me->getVictim()))
{
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}
}
}

View File

@@ -19,19 +19,18 @@
#ifndef TRINITY_REACTORAI_H
#define TRINITY_REACTORAI_H
#include "CreatureAI.h"
#include "CombatAI.h"
class Unit;
class ReactorAI : public CreatureAI
class ReactorAI : public AggressorAI
{
public:
explicit ReactorAI(Creature* c) : CreatureAI(c) {}
explicit ReactorAI(Creature* c) : AggressorAI(c) {}
void MoveInLineOfSight(Unit*);
void MoveInLineOfSight(Unit*) {};
void UpdateAI(const uint32);
static int Permissible(const Creature*);
};
#endif