mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
*AI structure update.
--HG-- branch : trunk
This commit is contained in:
@@ -63,20 +63,6 @@ void SummonList::DespawnAll()
|
||||
clear();
|
||||
}
|
||||
|
||||
bool ScriptedAI::IsVisible(Unit* who) const
|
||||
{
|
||||
if (!who)
|
||||
return false;
|
||||
|
||||
return (m_creature->GetDistance(who) < VISIBLE_RANGE) && who->isVisibleForOrDetect(m_creature,true);
|
||||
}
|
||||
|
||||
void ScriptedAI::MoveInLineOfSight(Unit *who)
|
||||
{
|
||||
if(!m_creature->getVictim() && m_creature->canStartAttack(who))
|
||||
AttackStart(who);
|
||||
}
|
||||
|
||||
void ScriptedAI::AttackStart(Unit* who, bool melee)
|
||||
{
|
||||
if (!who)
|
||||
@@ -121,7 +107,7 @@ void ScriptedAI::AttackStart(Unit* who)
|
||||
void ScriptedAI::UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Check if we have a current target
|
||||
if (m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim())
|
||||
if (m_creature->isAlive() && UpdateVictim())
|
||||
{
|
||||
if (m_creature->isAttackReady() )
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ GameObject* FindGameObject(uint32 entry, float range, Unit* Finder);
|
||||
|
||||
struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
||||
{
|
||||
ScriptedAI(Creature* creature) : m_creature(creature), InCombat(false), IsFleeing(false) {}
|
||||
ScriptedAI(Creature* creature) : CreatureAI(creature), m_creature(creature), InCombat(false), IsFleeing(false) {}
|
||||
~ScriptedAI() {}
|
||||
|
||||
//*************
|
||||
@@ -53,9 +53,6 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
||||
// Called at any Damage from any attacker (before damage apply)
|
||||
void DamageTaken(Unit *done_by, uint32 &damage) {}
|
||||
|
||||
//Is unit visible for MoveInLineOfSight
|
||||
bool IsVisible(Unit *who) const;
|
||||
|
||||
//Called at World update tick
|
||||
void UpdateAI(const uint32);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user