mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Merge pull request #9129 from m7nu3l/patch-2
Core/AI: Inherited AggressorAI, so the wheel is not reinvented.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user