--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-31 13:58:33 -06:00
273 changed files with 544 additions and 650 deletions

View File

@@ -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)
@@ -85,7 +71,6 @@ void ScriptedAI::AttackStart(Unit* who, bool melee)
if (m_creature->Attack(who, melee))
{
m_creature->AddThreat(who, 0.0f);
m_creature->SetInCombatWith(who);
if (!InCombat)
{
@@ -108,7 +93,6 @@ void ScriptedAI::AttackStart(Unit* who)
if (m_creature->Attack(who, true))
{
m_creature->AddThreat(who, 0.0f);
m_creature->SetInCombatWith(who);
if (!InCombat)
{
@@ -123,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() )
{
@@ -834,7 +818,6 @@ void Scripted_NoMovementAI::AttackStart(Unit* who)
if (m_creature->Attack(who, true))
{
m_creature->AddThreat(who, 0.0f);
m_creature->SetInCombatWith(who);
if (!InCombat)
{

View File

@@ -33,16 +33,13 @@ 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() {}
//*************
//CreatureAI Functions
//*************
//Called if IsVisible(Unit *who) is true at each *who move
void MoveInLineOfSight(Unit *);
//Called at each attack of m_creature by any victim
void AttackStart(Unit *);
void AttackStart(Unit *, bool melee);
@@ -53,9 +50,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);