*Update creature AI functions.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-11 11:46:48 -05:00
parent 5658963117
commit f631b2a2d6
9 changed files with 27 additions and 52 deletions

View File

@@ -12,10 +12,11 @@
#include "GridNotifiersImpl.h"
#include "Unit.h"
#include "GameObject.h"
#include "TemporarySummon.h"
#include "sc_creature.h"
#include "sc_gossip.h"
#include "sc_instance.h"
#include "AggressorAI.h"
#include "NullCreatureAI.h"
#ifdef WIN32
#include <windows.h>

View File

@@ -9,6 +9,7 @@
#include "Item.h"
#include "Spell.h"
#include "ObjectMgr.h"
#include "TemporarySummon.h"
// Spell summary for ScriptedAI::SelectSpell
struct TSpellSummary {
@@ -56,7 +57,10 @@ void SummonList::DespawnAll()
{
erase(begin());
summon->SetVisibility(VISIBILITY_OFF);
summon->setDeathState(JUST_DIED);
if(summon->HasSummonMask(SUMMON_MASK_SUMMON) && !summon->isPet())
((TempSummon*)summon)->UnSummon();
else
summon->setDeathState(JUST_DIED);
summon->RemoveCorpse();
}
}
@@ -109,26 +113,6 @@ void ScriptedAI::UpdateAI(const uint32 diff)
}
}
void ScriptedAI::EnterEvadeMode()
{
//m_creature->InterruptNonMeleeSpells(true);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
m_creature->LoadCreaturesAddon();
m_creature->SetLootRecipient(NULL);
if(m_creature->isAlive())
m_creature->GetMotionMaster()->MoveTargetedHome();
Reset();
}
void ScriptedAI::JustRespawned()
{
Reset();
}
void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle)
{
if (!victim)

View File

@@ -58,9 +58,6 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
void AttackStart(Unit *);
void AttackStart(Unit *, bool melee);
//Called at stoping attack by any attacker
void EnterEvadeMode();
// Called at any Damage from any attacker (before damage apply)
void DamageTaken(Unit *done_by, uint32 &damage) {}
@@ -85,9 +82,6 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
// Called when spell hits a target
void SpellHitTarget(Unit* target, const SpellEntry*) {}
// Called when creature is spawned or respawned (for reseting variables)
void JustRespawned();
//Called at waypoint reached or PointMovement end
void MovementInform(uint32 type, uint32 id){}
@@ -204,20 +198,6 @@ struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI
void AttackStart(Unit *);
};
struct TRINITY_DLL_DECL NullCreatureAI : public ScriptedAI
{
NullCreatureAI(Creature* c) : ScriptedAI(c) {}
~NullCreatureAI() {}
void Reset() {}
void EnterCombat(Unit*) {}
void MoveInLineOfSight(Unit *) {}
void AttackStart(Unit *) {}
void EnterEvadeMode() {}
void UpdateAI(const uint32) {}
};
struct TRINITY_DLL_DECL BossAI : public ScriptedAI
{
BossAI(Creature *c, uint32 id) : ScriptedAI(c), bossId(id)