mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
*Update creature AI functions.
--HG-- branch : trunk
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -53,7 +53,9 @@ EndScriptData */
|
||||
|
||||
struct TRINITY_DLL_DECL molten_flameAI : public NullCreatureAI
|
||||
{
|
||||
molten_flameAI(Creature *c) : NullCreatureAI(c)
|
||||
molten_flameAI(Creature *c) : NullCreatureAI(c) {}
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
float x, y, z;
|
||||
me->GetNearPoint(me, x, y, z, 1, 50, M_PI*2*rand_norm());
|
||||
|
||||
@@ -37,7 +37,7 @@ class TRINITY_DLL_DECL AggressorAI : public CreatureAI
|
||||
|
||||
typedef std::vector<uint32> SpellVct;
|
||||
|
||||
class TRINITY_DLL_DECL SpellAI : public CreatureAI
|
||||
class TRINITY_DLL_SPEC SpellAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit SpellAI(Creature *c) : CreatureAI(c) {}
|
||||
|
||||
@@ -112,6 +112,8 @@ void CreatureAI::EnterEvadeMode()
|
||||
|
||||
if(me->isAlive())
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
inline bool SelectTargetHelper(const Unit * me, const Unit * target, const bool &playerOnly, const float &dist, const int32 &aura)
|
||||
|
||||
@@ -123,7 +123,7 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
|
||||
//virtual void AttackedBy(Unit* attacker);
|
||||
|
||||
// Called when creature is spawned or respawned (for reseting variables)
|
||||
virtual void JustRespawned() {}
|
||||
virtual void JustRespawned() { Reset(); }
|
||||
|
||||
// Called at waypoint reached or point movement finished
|
||||
virtual void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) {}
|
||||
|
||||
@@ -28,35 +28,41 @@ class TRINITY_DLL_DECL PassiveAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit PassiveAI(Creature *c) : CreatureAI(c) {}
|
||||
~PassiveAI() {}
|
||||
|
||||
void MoveInLineOfSight(Unit *) {}
|
||||
void AttackStart(Unit *) {}
|
||||
|
||||
void UpdateAI(const uint32);
|
||||
|
||||
static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
|
||||
class TRINITY_DLL_DECL PossessedAI : public PassiveAI
|
||||
class TRINITY_DLL_DECL PossessedAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit PossessedAI(Creature *c) : PassiveAI(c) {}
|
||||
explicit PossessedAI(Creature *c) : CreatureAI(c) {}
|
||||
|
||||
void MoveInLineOfSight(Unit *) {}
|
||||
void AttackStart(Unit *target);
|
||||
void UpdateAI(const uint32);
|
||||
void EnterEvadeMode() {}
|
||||
|
||||
void JustDied(Unit*);
|
||||
void KilledUnit(Unit* victim);
|
||||
|
||||
static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
|
||||
class TRINITY_DLL_DECL NullCreatureAI : public PassiveAI
|
||||
class TRINITY_DLL_DECL NullCreatureAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
explicit NullCreatureAI(Creature *c) : PassiveAI(c) {}
|
||||
explicit NullCreatureAI(Creature *c) : CreatureAI(c) {}
|
||||
|
||||
void MoveInLineOfSight(Unit *) {}
|
||||
void AttackStart(Unit *) {}
|
||||
void UpdateAI(const uint32) {}
|
||||
void EnterEvadeMode() {}
|
||||
|
||||
static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; }
|
||||
};
|
||||
|
||||
class TRINITY_DLL_DECL CritterAI : public PassiveAI
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "Creature.h"
|
||||
|
||||
class TempSummon : public Creature
|
||||
class TRINITY_DLL_SPEC TempSummon : public Creature
|
||||
{
|
||||
public:
|
||||
explicit TempSummon(SummonPropertiesEntry const *properties, Unit *owner);
|
||||
|
||||
Reference in New Issue
Block a user