*Update AI scripts. Use better default AI.
--HG-- branch : trunk
This commit is contained in:
@@ -55,6 +55,7 @@ void SummonList::DespawnAll()
|
||||
else
|
||||
{
|
||||
erase(begin());
|
||||
summon->SetVisibility(VISIBILITY_OFF);
|
||||
summon->setDeathState(JUST_DIED);
|
||||
summon->RemoveCorpse();
|
||||
}
|
||||
@@ -634,6 +635,37 @@ void Scripted_NoMovementAI::AttackStart(Unit* who)
|
||||
}
|
||||
}
|
||||
|
||||
void BossAI::_Reset()
|
||||
{
|
||||
events.Reset();
|
||||
summons.DespawnAll();
|
||||
instance->SetBossState(bossId, NOT_STARTED);
|
||||
}
|
||||
|
||||
void BossAI::_JustDied()
|
||||
{
|
||||
events.Reset();
|
||||
summons.DespawnAll();
|
||||
instance->SetBossState(bossId, DONE);
|
||||
}
|
||||
|
||||
void BossAI::_EnterCombat()
|
||||
{
|
||||
DoZoneInCombat();
|
||||
instance->SetBossState(bossId, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void BossAI::JustSummoned(Creature *summon)
|
||||
{
|
||||
summons.Summon(summon);
|
||||
DoZoneInCombat(summon);
|
||||
}
|
||||
|
||||
void BossAI::SummonedCreatureDespawn(Creature *summon)
|
||||
{
|
||||
summons.Despawn(summon);
|
||||
}
|
||||
|
||||
#define GOBJECT(x) (const_cast<GameObjectInfo*>(GetGameObjectInfo(x)))
|
||||
|
||||
void LoadOverridenSQLData()
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
|
||||
class ScriptedInstance;
|
||||
|
||||
class SummonList : private std::list<uint64>
|
||||
{
|
||||
public:
|
||||
@@ -216,5 +218,30 @@ struct TRINITY_DLL_DECL NullCreatureAI : public ScriptedAI
|
||||
void UpdateAI(const uint32) {}
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL BossAI : public ScriptedAI
|
||||
{
|
||||
BossAI(Creature *c, uint32 id) : ScriptedAI(c), bossId(id)
|
||||
, summons(me), instance((ScriptedInstance*)c->GetInstanceData())
|
||||
{}
|
||||
|
||||
uint32 bossId;
|
||||
EventMap events;
|
||||
SummonList summons;
|
||||
ScriptedInstance *instance;
|
||||
|
||||
void JustSummoned(Creature *summon);
|
||||
void SummonedCreatureDespawn(Creature *summon);
|
||||
|
||||
void UpdateAI(const uint32 diff) = 0;
|
||||
|
||||
void _Reset();
|
||||
void _EnterCombat();
|
||||
void _JustDied();
|
||||
|
||||
void Reset() { _Reset(); }
|
||||
void EnterCombat(Unit *who) { _EnterCombat(); }
|
||||
void JustDied(Unit *killer) { _JustDied(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user